进出门系统的数据库问题
create table OriginalData ( PerNo int identity(1,1) primary key,
PerID nvarchar(20), Status int,
CheckTime datetime )
INSERT INTO OriginalData
SELECT 's001',1,'2007-06-11 08:01' UNION ALL
SELECT 's001',1,'2007-06-11 09:02' UNION ALL
SELECT 's001',0,'2007-06-11 10:05' UNION ALL
SELECT 's001',0,'2007-06-11 11:40' UNION ALL
SELECT 's001',1,'2007-06-11 12:00' UNION ALL
SELECT 's001',0,'2007-06-11 12:42' UNION ALL
SELECT 's001',1,'2007-06-11 13:58' UNION ALL
SELECT 's001',0,'2007-06-11 14:50' UNION ALL
SELECT 's001',0,'2007-06-11 15:00' UNION ALL
SELECT 's001',1,'2007-06-11 16:00' UNION ALL
SELECT 's001',1,'2007-06-11 16:30' UNION ALL
SELECT 's001',0,'2007-06-11 17:50' UNION ALL
SELECT 's001',0,'2007-06-11 18:00'
当有相邻的1或0时,查询出时间小的那个。查询出的结果是1,0,1,0,1....