日期:2014-05-17 浏览次数:20551 次
SELECT userid,CONVERT(VARCHAR(10),checktime,120) AS 'date',MIN(checktime) AS 't1' FROM checkinout where (checktime>'2013-6-1 1:00:00' and checktime<'2013-6-30 23:50:00') GROUP BY CONVERT(VARCHAR(10),checktime,120),userid order by userid,'date'
union all
SELECT userid,,CONVERT(VARCHAR(10),checktime,120) AS 'date',min(checktime) as t2 from checkinout where datename(hh,checktime)>12 and (checktime>'2013-6-1 1:00:00' and checktime<'2013-6-30 23:50:00') group by CONVERT(VARCHAR(10),checktime,120),userid order by userid
SELECT userid,
CONVERT(VARCHAR(10), checktime, 120) AS 'date',
Min(checktime) AS 't1',
NULL 't2'
FROM checkinout
WHERE ( checktime > '2013-6-1 1:00:00'