M
mgidron
I have a table that logs timestamped records.
How do you select the latest timestamp records for all items?
Example: With Item id 3, listed below I want only the latest recorded
record.
ITEM ID TEMP TIME HOUROFTEMP
------- ---- ---- ----------
1 100 9:20 PM 9:00 PM
3 90 9:10 PM 9:00 PM *
5 78 9:05 PM 9:00 PM
3 89 9:45 PM 9:00 PM * Need to select this record *
2 99 9:23 PM 9:00 PM
qry = selects all records for today
TRANSFORM First(qry.TEMP) AS FirstOfTemp
SELECT qry.ITEMNAME, qry.TIME
FROM qry
GROUP BY qry.ITEMNAME, qryTMod_Stage.TIME
PIVOT Format(qry.HOUROFTEMP,"h:nnAM/PM") In
("11:00AM","12:00PM","1:00PM","2:00PM","3:00PM","4:00PM",
"5:00PM","6:00PM","7:00PM","8:00PM","9:00PM","10:00PM");
Thanks,
Michael Gidron
(e-mail address removed)
(e-mail address removed)
How do you select the latest timestamp records for all items?
Example: With Item id 3, listed below I want only the latest recorded
record.
ITEM ID TEMP TIME HOUROFTEMP
------- ---- ---- ----------
1 100 9:20 PM 9:00 PM
3 90 9:10 PM 9:00 PM *
5 78 9:05 PM 9:00 PM
3 89 9:45 PM 9:00 PM * Need to select this record *
2 99 9:23 PM 9:00 PM
qry = selects all records for today
TRANSFORM First(qry.TEMP) AS FirstOfTemp
SELECT qry.ITEMNAME, qry.TIME
FROM qry
GROUP BY qry.ITEMNAME, qryTMod_Stage.TIME
PIVOT Format(qry.HOUROFTEMP,"h:nnAM/PM") In
("11:00AM","12:00PM","1:00PM","2:00PM","3:00PM","4:00PM",
"5:00PM","6:00PM","7:00PM","8:00PM","9:00PM","10:00PM");
Thanks,
Michael Gidron
(e-mail address removed)
(e-mail address removed)