I have two tables, cutting out the extra stuff they boil down to:
users:
userID int,
username varchar(11),
realname varchar(40)
logins:
ID int,
lastLogin timestamp
So, what I am doing is:
select user.id, username, realname, lastLogin
from users left join logins on users.id = logins.id
group by username
order by lastLogin DESC
What I want is all the users, no matter if they have logged in or not. That is what the
left join does. But, if they have logged in, I want the last login date. Right now I
get the first login date. Changing DESC to ASC only changes the display order of the
return set. I have added DESC and ASC to the group by, but that doesn't work at all.
Advice?
--ja
--