SQL group and order
- by John Lambert
I have multiple users with multiple entries recording times they arrive at destinations
Somehow, with my select query I would like to only show the most recent entries for each unique user name.
Here is the code that doesn't work:
SELECT * FROM $dbTable GROUP BY xNAME ORDER BY xDATETIME DESC
This does the name grouping fine, but as far as showing ONLY their most recent entry, is just shows the first entry it sees in the SQL table.
I guess my question is, is this possible?
Here is my data sample:
john 7:00
chris 7:30
greg 8:00
john 8:15
greg 8:30
chris 9:00
and my desired result should only be
john 8:15
chris 9:00
greg 8:30