Viewing 3 posts - 1 through 3 (of 3 total)
hi,
How about this for a solution:
-- my table definition
create table #Names (code int, [name] varchar(256))
-- do inserts...
-- use row number and sort to select top 1 in each code. ...
February 19, 2009 at 7:57 am
#946707
ok, what happens int eh case of a tie?
Good question, I supose I can select any of the options.
This code:
select ,[name], count(name) as cntfrom myctegroup by code, [name]
select ,[name], count(name) as cnt
from mycte
group by code, [name]
Returns:
Code...
February 17, 2009 at 11:44 am
#945352
Ok, sorry,
the real data looks like:
Code Name
75360412 Juan Arias Mejia.
75360412 ...
February 17, 2009 at 8:59 am
#945261