ex:1,anil@gmail.com 2,anil@gmail.com
select distinct(Emailid),StoreUserId from StoreUserEmails
Error:Keyfeildname is essential
SELECT * FROM (SELECT EmailId, StoreUserId, ROW_NUMBER() OVER (PARTITION BY EmailId ORDER BY StoreUserId) AS RowNumber FROM StoreUserEmails WHERE EmailId LIKE 'anil@gmail.com') AS a WHERE a.RowNumber = 1
SELECT DISTINCT Emailid FROM StoreUserEmails
begin select * into #val from val create table #output(id int, email varchar(100)) while((select COUNT(*) from #val) > 0) begin insert #output select top(1) * from #val delete from #val where email = (select top(1) email from #val) end select * from #output end
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)