with a as( select *,row_number() over(partition by hyid order by jp desc) rowid from rtc) select a.hyid, max(case when a.rowid=1 then a.mc END) mc, max(case when a.rowid=1 then a.jp END) jp, max(case when a.rowid=2 then a.mc END) mc2, max(case when a.rowid=2 then a.jp END) jp2, max(case when a.rowid=3 then a.mc END) mc3, max(case when a.rowid=3 then a.jp END) jp3, max(case when a.rowid=4 then a.mc END) mc4, max(case when a.rowid=4 then a.jp END) jp4, max(case when a.rowid=5 then a.mc END) mc5, max(case when a.rowid=5 then a.jp END) jp5 from a group by a.hyid
时间: 2024-11-02 02:36:33