日期:2014-05-18 浏览次数:20498 次
declare @t table (name varchar(2),tel int,time varchar(10)) insert into @t select '张',133,'2010-2-2' union all select '李',133,'2010-2-3' union all select '黄',134,'2010-2-4' union all select '张',135,'2010-2-5' union all select '王',135,'2010-2-6' select * from @t t where time=(select max(time) from @t where tel=t.tel ) order by time desc /* name tel time ---- ----------- ---------- 王 135 2010-2-6 黄 134 2010-2-4 李 133 2010-2-3 */