I have the following SQL statement:
E.RecName is the name of the sales route, H.RecKey is the handheld used to sync with that route and L.TimeStamp is the time of the sync.
My resident SQL expert is out on maternity leave. The query returns the right data, but I only want the last 5 syncs for each handheld. My SQL is not good enough to fix this to only give me that....
Anyone care to help a VB guy out? Thanks if so...
=======================================
People think it must be fun to be a super genius, but they don't realize how hard it is to put up with all the idiots in the world. (Calvin from Calvin And Hobbs)
Robert L. Johnson III
CCNA, CCDA, MCSA, CNA, Net+, A+, CHDP
VB/Access Programmer
Code:
SELECT E.RecName, H.RecKey, L.TimeStamp
FROM Employees AS E
JOIN Handhelds AS H ON H.EmpNid = E.EmpNid
JOIN Sessions AS S ON S.EmpNid = E.EmpNid
JOIN HandheldLog L ON L.SessionNid = S.SessionNid
WHERE E.PresellerFlag = 1 AND L.MethodName = 'SyncGetLatest'
AND L.TimeStamp BETWEEN '2006-08-01 00:00:00.001' AND '2006-10-04 00:00:00.001'
ORDER BY H.RecKey, E.RecName, L.TimeStamp DESC
E.RecName is the name of the sales route, H.RecKey is the handheld used to sync with that route and L.TimeStamp is the time of the sync.
My resident SQL expert is out on maternity leave. The query returns the right data, but I only want the last 5 syncs for each handheld. My SQL is not good enough to fix this to only give me that....
Anyone care to help a VB guy out? Thanks if so...
=======================================
People think it must be fun to be a super genius, but they don't realize how hard it is to put up with all the idiots in the world. (Calvin from Calvin And Hobbs)
Robert L. Johnson III
CCNA, CCDA, MCSA, CNA, Net+, A+, CHDP
VB/Access Programmer