sql - Group by duplicates by one column, but showing another column -


i have data in table:

id  | name -------------------- 265 | crazy row 265 | "crazy row" ltd 273 | simple  273 | simple & co 273 | "microsoft" corporation 273 | microsoft 284 | oracle 284 | 

i want remove rows same ids, still display name column.

so result should this:

id  | name -------------------- 265 | crazy row 273 | simple  284 | oracle 

it doesn't matter name value displayed: first [crazy row] or last ["crazy row" ltd].

i've written something, of course it's wrong

 select      l.[id], [name]       [list] l  join      (select [id]      [list]      group [id]      having count(*) > 1) x on l.id = x.id   

edited: there normal rows (not duplicates) in table. aim find duplicates , show single name, that's because in sql code i'm finding duplicates first

here u are

select id, max(name ) [list] l group id 

Comments

Popular posts from this blog

Email notification in google apps script -

c++ - Difference between pre and post decrement in recursive function argument -

javascript - IE11 incompatibility with jQuery's 'readonly'? -