MySQL Forums
Forum List  »  Newbie

Help with Max(date) per keyField - get most recent data
Posted by: Scott Critchley
Date: March 30, 2006 08:34AM

I have a large list of daily stats from various systems, i.e.

Table Stats
SystemID | tagID | dtStamp | Value
S001 : T100 : 2006-03-23 : 50
S001 : T101 : 2006-03-23 : 2
S001 : T100 : 2006-03-24 : 53
S001 : T101 : 2006-03-24 : 5
S001 : T100 : 2006-03-25 : 60
S001 : T101 : 2006-03-25 : 8
S001 : T100 : 2006-03-26 : 65
S001 : T101 : 2006-03-26 : 12
S002 : T100 : 2006-03-23 : 10
S002 : T101 : 2006-03-23 : 1
S002 : T100 : 2006-03-24 : 12
S002 : T101 : 2006-03-24 : 2

I need the date of the last record of data for each site for each tag. (i.e. the most recent data for each site)

I tried using max(dtStamp), but it found the biggest date in the table and tied it to every system/tag the same. i.e. it showed 2006-03-26 for S002/T101, even though I know I don't have data for that site on that day.

Thanks!
Cheers,
Scott.

Options: ReplyQuote


Subject
Written By
Posted
Help with Max(date) per keyField - get most recent data
March 30, 2006 08:34AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.