日期:2014-05-17 浏览次数:20642 次
----------------------------
--?Author??:DBA_Huangzj(發糞塗牆)
--?Date????:2013-09-10?10:43:11
--?Version:
--??????Microsoft?SQL?Server?2014?(CTP1)?-?11.0.9120.5?(X64)?
--??? Jun?10?2013?20:09:10?
--??? Copyright?(c)?Microsoft?Corporation
--??? Enterprise?Evaluation?Edition?(64-bit)?on?Windows?NT?6.2?<X64>?(Build?9200:?)?(Hypervisor)
--
----------------------------
--> 测试数据:[huang]
if object_id('[huang]') is not null drop table [huang]
go
create table [huang]([ID] int,[CODE] varchar(2),[NAME] varchar(4),[TIME] datetime)
insert [huang]
select 1,'A1','张三','2012-1-1 09:00:12' union all
select 2,'A1','张三','2012-1-1 12:59:11' union all
select 3,'A1','张三','2012-1-1 18:00:23' union all
select 4,'A2','李四','2012-1-1 08:56:32' union all
select 5,'A2','李四','2012-1-1 10:59:12' union all
select 6,'A2','李四','2012-1-1 12:00:08' union all
select 7,'A2','李四','2012-1-1 18:12:23' union all
select 8,'A1','张三','2012-2-1 09:00:12' union all
select 9,'A1','张三','2012-2-1 12:59:11' union all
select 10,'A1','张三','2012-2-1 18:00:23' union all
select 11,'A2','李四','2012-2-1 08:56:32' union all