如何使用datediff()作为列? [英] How to use datediff() for columns?
本文介绍了如何使用datediff()作为列?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想知道如何区分两列之间的时间段,如时间和时间?
I wanna know how to differentiate a time period in a day between two columns like in time and out time?
推荐答案
请参阅 http://www.w3schools.com/sql/func_datediff.asp [ ^ ] [ datediff ^ ]
时间只需使用适当的缩写。开始和结束日期可以是列
Refer to http://www.w3schools.com/sql/func_datediff.asp[^][datediff^]
For time just use the appropriate abbreviation. Start and end date can be the columns
尝试:
Try:
SELECT DATEDIFF(hh, startDateColumn, endDateColumn) As [Span In Hours] FROM MyTable
这篇关于如何使用datediff()作为列?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文