日期:2014-05-19  浏览次数:20441 次

求语句
时间---intA-----intB
--             1                   1
--             1                   2
--             2                   4
--           ..                 ..
要搜索表中     按时间倒叙排列后,对于每一个intA,他的最后一次发生的B

结果以列表返回




------解决方案--------------------
select t.* from 表 t where not exists(select 1 from 表 where intA=t.intA and 时间> t.时间)
------解决方案--------------------
select * from 时间 a where not exists(select 1 from 时间 b where a.intA=b.intA and a.intB <b.intB)