November 14, 2001 at 2:06 pm
I have a table "customers" with 2 fields: "ID" and "Name"
there are multiple rows in this table with the same ID, and different Names.
Example:
ID Name
---------------
201 M. Mamet
201 Matthew Mamet
How do i write -ONE- SQL statement that gets me a list of names for distinct IDs?
I don't care which name it pulls, I just want a list of 1 name for 1 ID.
Thanks!
Matthew
Matthew Mamet
November 14, 2001 at 4:09 pm
select id, name = max(name)
from tbl
group by id
Cursors never.
DTS - only when needed and never to control.
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply
This website stores cookies on your computer.
These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media.
To find out more about the cookies we use, see our Privacy Policy