Hello, I'm using MySQL3.23.
I have an interesting challenge that I'd like to accommplish in a single query.
Imagine two tables,
Table 1
userid
fname
lname
Table 2
userid
other stuff
I'd like to SELECT DISTINCT userid FROM table2
but join the information to fname and lname from table 1.
It seems like it's simple enough, but it I don't think I've worked with DISTINCT enough to understand it's limitations.
My simple query of:
SELECT DISTINCT table2.userid, fname,lname FROM table1,table2 WHERE table2.userid = table1.userid;
Returns all possible combinations of the data. I only want the first name and last name of each user id that appears at least once in table 2.