I have 500 Kiosks in stores and have a table that tracks each print's timestamp by store ID. I need to produce a recordset that gives me the time between prints in seconds. All this data is stored in a single table. A record is inserted for each print and contains the store ID and timeStamp.
TABLE NAME = print
id store_id timestamp
1 1 2013-3-1 00:00:01
2 2 2013-3-1 00:00:01 *
3 3 2013-3-1 00:00:01
4 2 2013-3-1 00:00:12 *
5 3 2013-3-1 00:00:06
6 2 2013-3-1 00:00:15 *
I need to pull the time in seconds between ALL of store #2 prints. The * is so you can find the records I need to compare easily.
RecordSet Results Below:
id store_id myTimeDiffSeconds
2 2 0
4 2 11
6 2 3
This needs to be simple and fast. Can I do this without a temp table?