create table temptbl as select a.id,
b.endtime as starttime,
a.endtime,
a.parentid,
a.initstateid,
a.ispass,
a.suggest,
a.auditoperid
from hisrecord_13 a
left join hisrecord_13 b on a.parentid = b.id
where a.parentid <> 0
union
select *
from hisrecord_13 vv
where vv.parentid = 0
order by id