0
我正在嘗試獲取事務的已用時間。我需要將它解壓縮到一個文件中。 我發現德比一些SQL在線不行,因爲我想它:derby中兩個日期之間的timestampdiff
ij> create table atab1(ts timestamp, i int, ts1 timestamp);
ij> insert into atab1 values(CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP);
1 row inserted/updated/deleted
ij> insert into atab1 values(CURRENT_TIMESTAMP, 2, CURRENT_TIMESTAMP);
1 row inserted/updated/deleted
ij> select {fn TIMESTAMPDIFF(SQL_TSI_SECOND, ts1,ts)} as TS_DIFF from atab1;
TS_DIFF
-----------
0
0
的atab1表的內容是:
TS |I |TS1
-----------------------------------------------------------------------
2012-08-05 00:20:16.675 |1 |2012-08-05 00:20:16.675
2012-08-05 00:20:29.081 |2 |2012-08-05 00:20:29.081
聲明:
select {fn TIMESTAMPDIFF(SQL_TSI_SECOND, ts1,ts)} as TS_DIFF from atab1;
將始終爲0,因爲ts1和ts的值相同
我應該如何調整t聲明是否會顯示ts和ts1的值之間的差異?