select distinct id with other data

M

Mario Krsnic

Hello everybody,
I have a table with such data:
id name
1 Mario
1 Mario Krsnic
1 MKrsnic
1 MarioK
The same Id refers to different names of the same person.
how can I select distinct ID with both columns? If I use select distinct
id,name then I get the above data. I would like to have only:
1,Mario(or some other variante of the name)
In the result should every id appear only once.
Thanks for suggestions!
Mario
 
M

Marshall Barton

Mario said:
I have a table with such data:
id name
1 Mario
1 Mario Krsnic
1 MKrsnic
1 MarioK
The same Id refers to different names of the same person.
how can I select distinct ID with both columns? If I use select distinct
id,name then I get the above data. I would like to have only:
1,Mario(or some other variante of the name)
In the result should every id appear only once.


Try using this kind of query:

SELECT ID, First([Name[)
FROM [the table]
GROUP BY ID
 
Top