>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.