hi
I want to select the record out of a table with the highest time (MAX(time)) and I want to get the username from that record. This should only be records where ctId=0.
I first tried:
SELECT MAX(time),username FROM table WHERE ctId=0
but that gave me a grouping error
then I did some research about groups and stuff, since I didn't know that much about them, and I tried:
SELECT max(time),username,ctId FROM table GROUP BY username,ctId HAVING ctId=0 AND MAX(time)
But that gives me not the record with the highest time... :-\
You have any idea what I am doing wrong?
Thank you in advance
edit: I made a typo in the code