日期:2014-05-17 浏览次数:20788 次
select t.ID,t.ECCODE,t.ACCESSNUMBER,t.SERVICECODE,t.CREATETIME from ecorderins t where t.servicecode='5001' and t.oprcode='02' and t.state=2
ID ECCODE ACCESSNUMBER SERVICECODE CREATETIME
1 4001 7001 5001 20130805100835
2 4001 7001 5001 20130805101033
3 4001 7001 5001 20130805112805
4 4004 7004 5001 20130804100835
6 4001 7006 5001 20130805170102
7 4007 7007 5001 20130802100835
9 4009 7009 5001 20130805084531
select t.*
from (select ID,ECCODE,ACCESSNUMBER,SERVICECODE,CREATETIME,ruw_number()over(partition by servicecode,oprcode,state order by CREATETIME desc)rn
from ecorderins)t
where t.rn=1;