need distinct records of whle table but distinct on one field

ukdata

New member
Local time
Today, 15:17
Joined
Sep 15, 2006
Messages
1
Hi, Wish if some one could help me ASAP.
I have a table which contains name, tel, email
i need to import only records which have distinct email.
I do need need to import data of all three fields but only which has distinct email.
As there are number of record which are duplicate.
They have different names but same email.
So i need to condition only for distinct email but dump the data in a new table with all three records.
so same names can have different email.
but same email can't have duplicate email.
So need only records which have distinct email.
Please help .......
 
Try something like:
Code:
SELECT T1.*
FROM [b]MyTable[/b] AS T1
WHERE T1.[b]email[/b] IN
 (SELECT T2.[b]email[/b]
  FROM [b]MyTable[/b] AS T2
  GROUP BY T2.[b]email[/b]
  HAVING COUNT(T2.[b]email[/b])=1
 )
;

(NOTE: substitute table and field names in boldface 
with the actual table and field names)
This should return only the records for which there is one instance of the email.
 

Users who are viewing this thread

Back
Top Bottom