s0c0 Posted July 10, 2007 Share Posted July 10, 2007 Here is my current query: SELECT tbl1.id, tbl1.username, tbl1.status, tbl1.joined, tbl2.timeDate, tbl1.directory FROM tbl1, tbl2 WHERE tbl1.id = tbl2.users_id GROUP BY tbl1.id This returns their oldest ie first login. I use this for analytics on the backend to determine user activity. So I would like a query that instead that returns the most recent tbl2.timeDate And ideas? Thanks in advanced. Link to comment https://forums.phpfreaks.com/topic/59187-solved-need-to-get-most-recent-row-on-an-inner-join-mysql-query-based-on-date/ Share on other sites More sharing options...
teng84 Posted July 10, 2007 Share Posted July 10, 2007 add order by clause Link to comment https://forums.phpfreaks.com/topic/59187-solved-need-to-get-most-recent-row-on-an-inner-join-mysql-query-based-on-date/#findComment-293986 Share on other sites More sharing options...
s0c0 Posted July 10, 2007 Author Share Posted July 10, 2007 ORDER BY timeDate DESC resolves issue, thanks, I swear I tried that but then again SQL is not a strong point for me, appreciated much teng84 Link to comment https://forums.phpfreaks.com/topic/59187-solved-need-to-get-most-recent-row-on-an-inner-join-mysql-query-based-on-date/#findComment-293992 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.