日期:2014-05-18 浏览次数:20509 次
--你要的是最小的syno 好像是用的是这个
select * from tbl where not exists(select * from tbl where id=a.id and time=a.time and department=a.department and sysno <a.sysno)
--方法一: select a.* from tb a, (select id,time,department,min(sysno) sysno from tb group by id,time,department) b where a.id = b.id and a.time = b.time and a.department = b.department and a.sysno = b.sysno --方法二: select a.* from tb a where sysno = (select min(sysno) from tb where id = a.id and time = a.time and department = a.department)