Hello,
I have a table which contains id, EmailAddress, Storeid,Rn . The EmailAddreses can repeat using different storeid. The table already has records with Rn ( Row Number()) applied.
CREATE TABLE #Profile( id INT IDENTITY (1,1) PRIMARY KEY , EmailAddress VARCHAR( 100) NOT NULL, Storeid INT NOT NULL, Rn INT NOT NULL ) INSERT #Profile(EmailAddress, Storeid, Rn) VALUES ('abc@gmail.com',12,1) INSERT #Profile(EmailAddress, Storeid, Rn) VALUES ('abc@gmail.com',13,2) INSERT #Profile(EmailAddress, Storeid, Rn) VALUES ('abc@gmail.com',14,3) INSERT #Profile(EmailAddress, Storeid, Rn) VALUES ('ac@gmail.com',12,1) INSERT #Profile(EmailAddress, Storeid, Rn) VALUES ('ab@gmail.com',12,1) INSERT #Profile(EmailAddress, Storeid, Rn) VALUES ('ab@gmail.com',13,2) INSERT #Profile(EmailAddress, Storeid, Rn) VALUES ('ab@gmail.com',14,3) INSERT #Profile(EmailAddress, Storeid, Rn) VALUES ('ab@gmail.com',15,4) SELECT * FROM #Profile
I want to query the table in such a way that I would get all the emailaddress present only once- ac@gmail.com
Please advice .
Thanks
EVA05