取出数据库表里面同一类型最新的一条数据

 select * from table as a inner join 
 ( 
 select MAX(dtmcreateDate) as datetimes,lngExposureID from table group by lngExposureID
 ) as  b on a.lngExposureID = b.lngExposureID and a.dtmcreateDate = b.datetimes

思路:根据类型group,取出最新时间数据,在根据联合主键查询出其他列

posted @ 2015-11-26 16:30  红鲤鱼与驴与绿鲤鱼  阅读(779)  评论(0编辑  收藏  举报