日期:2014-05-17 浏览次数:20445 次
----------------------------
-- Author :磊仔
-- Date :2013-01-24 22:38:56
-- Version:
-- Microsoft SQL Server 2008 (SP2) - 10.0.4000.0 (Intel X86)
-- Sep 16 2010 20:09:22
-- Copyright (c) 1988-2008 Microsoft Corporation
-- Enterprise Edition on Windows NT 6.1 <X86> (Build 7600: )
--
----------------------------
--> 测试数据:#TA
if object_id('tempdb.dbo.#TA') is not null drop table #TA
go
create table #TA([ID] int,[Speed] int,[Time] datetime)
insert #TA
select 1,10,'2013/1/23 10:00:00' union all
select 2,20,'2013/1/23 10:20:00' union all
select 3,50,'2013/1/23 10:50:00' union all
select 4,60,'2013/1/23 11:20:00' union all
select 5,29,'2013/1/23 12:20:00' union all
select 6,45,'2013/1/24 10:20:00' union all
select 7,48,'2013/1/24 10:49:00' union all
select 8,39,'2013/1/24 11:00:00' union all
select 9,41,'2013/1/24 12:20:00' union all
select 10,29,'2013/1/24 12:25:00' union all
select 1