日期:2014-05-17 浏览次数:20645 次
declare @T table (userid int,reguid int,xftime datetime,xfpoint int,sypoint int)
insert into @T
select 1,2,'2012-09-07 14:56:23',2,0 union all
select 1,2,'2012-09-07 16:44:14',2,0 union all
select 1,3,'2012-09-08 15:56:23',2,0
select * from @T t
where xftime=(select max(xftime) from @T where reguid=t.reguid)
and userid=1
/*
userid reguid xftime xfpoint sypoint
----------- ----------- ----------------------- ----------- -----------
1 2 2012-09-07 16:44:14.000 2 0
1 3 2012-09-08 15:56:23.000 2 0
*/