一定時間遲到的總時間 考勤

2021-05-09 09:03:35 字數 2434 閱讀 1230

declare @a table(id int,deptcode varchar(20),[datetime] datetime)

insert @a select 32,'財務部','2009-10-17 08:54:02.000'

union all select 32,'財務部','2009-10-17 12:02:10.000'

union all select 32,'財務部','2009-10-17 13:07:19.000'

union all select 32,'財務部','2009-10-17 18:32:34.000'

union all select 32,'財務部','2009-10-18 08:53:30.000'

union all select 32,'財務部','2009-10-18 11:38:00.000'

union all select 32,'財務部','2009-10-18 16:50:28.000'

union all select 32,'財務部','2009-10-18 18:34:45.000'

union all select 32,'財務部','2009-10-19 08:52:29.000'

union all select 32,'財務部','2009-10-19 12:05:29.000'

union all select 32,'財務部','2009-10-19 13:08:57.000'

union all select 32,'財務部','2009-10-19 18:34:04.000'

union all select 32,'財務部','2009-10-20 08:53:28.000'

union all select 32,'財務部','2009-10-01 09:00:25.000'

union all select 32,'財務部','2009-10-01 18:30:46.000'

union all select 32,'財務部','2009-10-02 18:30:53.000'

union all select 32,'財務部','2009-10-04 09:00:52.000'

union all select 32,'財務部','2009-10-07 18:30:59.000'

union all select 32,'財務部','2009-10-12 18:30:33.000'

union all select 32,'辦公室','2009-10-12 18:41:53.000'

union all select 32,'辦公室','2009-10-14 08:59:00.000'

union all select 32,'辦公室','2009-10-14 18:41:13.000'

union all select 32,'辦公室','2009-10-15 08:54:45.000'

union all select 32,'辦公室','2009-10-15 18:33:30.000'

union all select 32,'辦公室','2009-10-16 08:57:13.000'

union all select 32,'辦公室','2009-10-16 17:59:00.000'

union all select 32,'辦公室','2009-10-17 08:52:05.000'

union all select 32,'辦公室','2009-10-17 18:35:23.000'

union all select 32,'辦公室','2009-10-18 08:52:03.000'

union all select 32,'辦公室','2009-10-18 18:37:04.000'

union all select 32,'辦公室','2009-10-20 08:50:56.000'

union all select 32,'辦公室','2009-10-20 18:36:19.000'

union all select 32,'辦公室','2009-10-21 08:54:43.000'

select id, count(distinct [date]) days,

abs(sum(case when x<0 then x else 0 end)) mins

from (select id,deptcode,convert(varchar(10),[datetime],120)

[date],[datetime],datediff(minute,convert(varchar(10),

[datetime],120)+' 09:00:00.000',[datetime]) x

from @a where convert(varchar(7),[datetime],120)='2009-10'

) aa

group by id

一定時間後延時變長問題

寫程式時我們經常用ishell settimer 來設定延時,控制一些自動移動的物體,比如說俄羅斯方塊中長條的下降,在模擬器上執行的時候我們會遇到這樣的問題,當一定時間我們沒有碰鍵盤後,移動會變的特別慢,不過再按任何乙個鍵一切又正常了,這是因為模擬了裝置休眠的原因,在brew sdk中也有提到原因和...

讓wince的背景光在系統空閒一定時間後自動關閉

看到 別人解決這個問題的思路,現在轉下 1修改登錄檔就可以了,在 hkey current user controlpanel backlight 下面修改值就可以搞定 2當然這個不光是要修改登錄檔,在底層按鍵控制的 中,一般都有一些關於背光檢測和按鍵 觸控螢幕 檢測的執行緒 我們用的平台可能不一樣...

linux查詢超過一定時間的檔案,並批量刪除

1 find maxdepth 4 name mtime 3 maxdepth的值決定是否對下面的子目錄進行遞迴查詢 mtime 3表示查詢剛好3天的 mtime 3表示查詢超過3天的,也就是查詢3天前的檔案 mtime 3表示查詢3天內的,最近3天內的 2 find maxdepth 4 name...