Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Duplicate records
Message
 
To
19/07/2005 00:43:09
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 8 SP1
Miscellaneous
Thread ID:
01033719
Message ID:
01033735
Views:
16
This message has been marked as the solution to the initial question of the thread.
>Hi friends
>i need ur advise on this query.I've 2 fields in a table (patient,invoice).
>field invoice contains invoice no for a patient.this no can be duplicated for the same patient but not for the different patient.
>i mean we can have data like this
>
>patient invoice
>pk patient invoice
>1 John I001
>2 John I001
>3 Paul I002
>
>but there should not be like following
>pk patient invoice
>A1 John I001
>A2 John I001
>A3 Paul I001 --its wrong
>A4 Paul I002
>
>my question is how can i find out such duplicates ?
>Thanks

Try this:
SELECT patient, invoice;
       FROM Patients PInvoice;
WHERE PInvoice.Invoice IN;
     (SELECT Invoice FROM Patients PDup WHERE PDup.Patient # PInvoice.Patient);
GROUP BY PInvoice.patient, PInvoice.invoice;
INTO CURSOR cTest
(not tested)
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform