Quantcast
Channel: SQL Query to get latest records for that user - Stack Overflow
Viewing all articles
Browse latest Browse all 4

Answer by Dominik Mayrhofer for SQL Query to get latest records for that user

$
0
0

I think the easiest way would be to join the tables max value to the current table somehow like this

SELECT user, `date`FROM yourtableINNER JOIN (  SELECT MAX(date) AS `date`, user  FROM yourtable  GROUP BY user) latest ON latest.`date`= yourtable.`date` AND latest.user = yourtable.user

Viewing all articles
Browse latest Browse all 4

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>