0
我想在SQL Server中添加時間。我在數據庫中有一個名爲checktime
的列,它是一個datetime
數據類型。我想添加從列checktime
的時間。我怎樣才能做到這一點 ??在SQL Server 2008中添加時間
我正在做這個計算來計算一個員工在指定的一天中工作的總時數。
我的數據庫看起來像這樣..我想從checktime
增加時間,其中checktype = 1
和checktype = 2
然後減去結果。 (checktype = 1表示檢入並且checktype = 2表示檢出)
我該怎麼做?
Id EmpId CheckTime CheckType
---------------------------------------------------------------------------------
3 5 2013-01-03 09:00:15.000 1
4 5 2013-01-03 11:00:00.000 2
5 5 2013-01-03 11:30:00.000 1
6 5 2013-01-03 13:00:00.000 2
7 5 2013-01-03 13:30:00.000 1
8 5 2013-01-03 16:00:00.000 2
9 5 2013-01-03 16:30:00.000 1
10 5 2013-01-03 18:00:00.000 2
你能在此解釋一下?我不明白你想添加到檢查時間。 –
添加時間是什麼意思? – Walter
我想要checktype的總數與checktype = 1 ...(09:00:15.000 +11:30:00.000 +13:30:00.000 + 16:30:00.000) –