這裏之間時間戳差值是我與在MS Access從系統跟蹤處理的數據時,代理使得系統的變化:ACCESS:計算行
|agentid|eventtype|reasoncode|eventdatetimelocal |
|1830 |2 |32762 |01/01/2014 7:11:44 PM|
|1830 |3 |0 |01/01/2014 7:13:46 PM|
|1830 |2 |32762 |01/01/2014 7:14:55 PM|
|1833 |2 |0 |01/01/2014 7:11:35 PM|
|1833 |3 |32762 |01/01/2014 7:13:25 PM|
我需要確定在它們之間經過的秒數行代理。我還想保留事件類型和原因代碼的細節。
我試圖加入一個subqry,但它不工作:
SELECT sub1.agentid,
sub1.eventtype,
sub1.reasoncode,
sub1.eventdatetimelocal,
(sub1.next_timestamp-sub1.eventdatetimelocal) AS duration
FROM (SELECT i.agentid,
eventdatetimelocal,
eventtype,
reasoncode, (SELECT
Min([eventdatetimelocal])
FROM state_detail_tbl
WHERE [eventdatetimelocal] > i.eventdatetimelocal
) AS next_timestamp
FROM state_detail_tbl AS i
WHERE i.eventdatetimelocal BETWEEN #01/01/2014# AND #01/31/2014#
) AS sub1;
您的樣本數據的預期輸出是什麼? – Gustav
我期望沿着這樣的方向行事:agentid,eventype1,reasoncode1,eventdatetimelocal1,eventdatetimelocal2,eventtype2,reasoncode2,秒。通過這種方式,我可以獲得衝頭,衝出,事件和原因代碼以及持續時間。 – rynsmns