SELECT t1.* FROM(
SELECT
tr.trail_id,
tr.biz_form_id,
tr.trail_number,
tr.main_opinion,
tr.node_name,
ROW_NUMBER ( ) OVER ( PARTITION BY tr.biz_form_id ORDER BY tr.create_time DESC ) AS rn
FROM
mes_device_manage_trail tr
) t1
WHERE
t1.rn = 1
SELECT tr.trail_id,tr.biz_form_id,tr.trail_number,tr.main_opinion,tr.node_name
FROM mes_device_manage_trail tr ,(select max(trail_id) trail_id from mes_device_manage_trail group by BIZ_FORM_ID) t
where tr.TRAIL_ID=t.trail_id