I have a table called DynamicText
with the following fields: DynamicID
, Content
, Timestamp
, and DynamicTextEnum
.
I'm trying to do design a query that would select the most recent record based on Timestamp
from each of the groups that are grouped by DynamicTextEnum
.
For example:
Enum Timestamp
-----------------
1 1/10/2012
1 2/10/2012
2 1/10/2012
3 3/10/2012
2 3/10/2012
3 4/10/2012
So the results would look like this:
Enum Timestamp
-----------------
1 2/10/2012
2 3/10/2012
3 4/10/2012
My current simply SELECTS TOP 1
them based on Enum and orders them in DESC order based on
Timestamp
but it doesn't work when I need all Enums. Any ideas?