select sn, pname, srnum, rerepairtime, rn from ( select sn,pname, srnum, rerepairtime,row_number() over(partition by assetsid order by rerepairtime desc) rn from atzserreportb ) where rn = 1