当前位置: 代码迷 >> Sql Server >> 取记录.该如何处理
  详细解决方案

取记录.该如何处理

热度:36   发布时间:2016-04-27 16:41:05.0
取记录.
记录:
  a     2007-1-1
  a     2007-1-2
  a     2007-1-3
  a     2007-1-4
  b     2007-1-11
  b     2007-1-21
  b     2007-1-31
  b     2007-1-14
  b     2007-1-15
  c     2007-1-21
  c     2007-1-24
去a   b   c   3条记录   按日期排序

------解决方案--------------------
select
t.*
from
表 t
where
not exists(select 1 from 表 where type=t.type and date> t.date)
order by
t.date desc
  相关解决方案