|
-
March 11th, 2010, 04:38 PM
#1
SQL group by order by
Code:
SELECT * FROM $dbTable GROUP BY xNAME ORDER BY xDATETIME DESC
What I am trying to do is extract only most recent entries for each unique xNAME. I can't figure out how to do this.
SO here is my example table:
john 8:00
greg 9:00
rick 10:00
john 10:15
rick 10:30
greg 11:00
and my desired result is:
john 10:15
greg 11:00
rick 10:30
Is this possible?
-
March 11th, 2010, 06:00 PM
#2
Re: SQL group by order by
How about using Max(xDATETIME ?
Victor Nijegorodov
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|