This is my table struct in sql server 2008:
+--------+-----+---------------------+
| user | val | time |
+--------+-----+---------------------+
| kk | 21 | 2011-12-12 12:23:00 |
| dd | 33 | 2011-12-12 12:23:00 |
| kk | 22 | 2011-12-12 12:23:30 |
| dd | 33 | 2011-12-12 12:23:30 |
+--------+-----+---------------------+
This record in the table are updated by other application every 30 seconds.
Now,I want to query the latest records of all the user in the table.
Any way to implement it using just one sql query?
This will list the user and the latest time entry
If you need the associated data, try this