Hi Guys i have 2 tables (user/logs kinda thing)
tk_assets (the users) tk_sessions (the logs) <-- where each log contains both stamp_in and stamp_out epoch values (making up 1 session of the user.
User is considered logged in when its latest session does not have a stamp_out value (still logged in)
I simply need to retrieve all users in the database along its "LATEST SESSION"..
In plain english, this would be "SELECT each user as well as its most recent session"
I can't seem to figure out the proper SQL statement for this..
SELECT
tk_assets.ass_id,
tk_sessions.stamp_in,
tk_sessions.stamp_out
FROM
tk_assets
LEFT JOIN tk_sessions ON tk_assets.ass_id = tk_sessions.ass_id
GROUP BY
tk_sessions.ass_id
ORDER BY
tk_sessions.stamp_in DESC
this is as far as i got..