I think I'm a little confused as to the nature of DISTINCT
It seems that DISTINCT uses all the columns in the select statement and not just the first one.
SELECT DISTINCT userID, name FROM some_table
will return all the distinct pairs of userID and name..
what I would like is a list of distinct userIDs with the names attached to each one.
so if i had:
10 Billy
20 Bobby
20 Sally
30 George
10 Derek
I would get:
10 Billy
20 Bobby
30 George
Basically, the first record the is found with a distinct userID would be returned and then none of the others.
It seems that DISTINCT uses all the columns in the select statement and not just the first one.
SELECT DISTINCT userID, name FROM some_table
will return all the distinct pairs of userID and name..
what I would like is a list of distinct userIDs with the names attached to each one.
so if i had:
10 Billy
20 Bobby
20 Sally
30 George
10 Derek
I would get:
10 Billy
20 Bobby
30 George
Basically, the first record the is found with a distinct userID would be returned and then none of the others.