4
我有一個是生產像這樣的查詢之間的差異獲取:如何2列
StartTimestamp | EndTimestamp
================================
100 | 450
--------------------------------
150 | 500
我想結果也包括EndTimestamp和StartTimestamp之間的區別:
StartTimestamp | EndTimestamp | Difference
==============================================
100 | 450 | 350
----------------------------------------------
150 | 600 | 450
如何在MySQL中執行此操作?
@Alex ...我想檢查'差異'是否大於'零'。我怎麼檢查這個? – someone 2014-06-08 07:38:31
您可以使用'SELECT StartTimestamp,EndTimestamp,EndTimestamp - StartTimestamp AS Difference,case when(EndTimestamp - StartTimestamp)> 0 then'Greater than 0'else'Less than /等於0'結尾爲My_Flag FROM mytablename' – Karvy1 2015-11-25 18:57:58