0
我有幾個列:SQL減去日期/時間的爲一個價值
| Start | END | Duration
2008-06-28 18.03.55 | 2008-10-06 01.33.55 | End - Start
我的代碼如下所示:
SELECT theDelivery,
(char(theDelivery) || ' ' || char(current time)) AS Begin,
(char(theDelivery + 100 DAYS) || ' ' || char(current time + 7 HOURS + 30 MINUTES)) AS End
這是我想過做減法...但它的錯誤。我知道你不能減去別名'任何想法? ((CHAR(當前時間+ 7小時+ 30分鐘) - (CHAR(theDelivery + 100天)))
所以我想通了,我打算全部錯了焦炭的我想出了這一點,這正是我一直在尋找:
SELECT theDelivery,
TIMESTAMP(theDelivery, current time) AS Begin
,
TIMESTAMP((theDelivery + 100 DAYS), (current time + 7 HOURS + 30 MINUTES)) AS End,
TIMESTAMP((theDelivery + 100 DAYS), (current time + 7 HOURS + 30 MINUTES)) - TIMESTAMP(theDelivery, current time) AS MyDur
請注意,結果將被_imprecise_,而不是** **中的任何一個確切的數字。 –
檢查我在原來的問題下編輯我! –