so i have a table for user sessions w/ both stamp_in and stamp_out (epoch) for each session
TABLE: tk_sessions
columns: ses_id | ass_id | stamp_in | stamp_out
(ass_id stands for asset ID hehe)
i basically just want to retrieve the latest sessions for each asset...
So i tried this:
SELECT ses_id,ass_id,stamp_in,stamp_out
FROM tk_sessions
ORDER BY stamp_in DESC
that returns ALL the sessions in the expected descending order I just want to return 1 of each ass_id so i added the GROUP BY ass_id statement
SELECT ses_id,ass_id,stamp_in,stamp_out
FROM tk_sessions GROUP BY ass_id
ORDER BY stamp_in DESC
but the results are odd... this seems to return 1 row for each ass_id as expected, but are returning the wrong sessions (not the latest stamp_in sessions)
What gives?
scratches head