
因為85和86行的resource_id一樣,在sqlserver如何把86行的enname,phone和time放到85行的next_enname,next_phone和next_time
uj5u.com熱心網友回復:
selectb.resource_id,
b.apply_reason,
b.time,
(select time from
( select *,row_number() over(partition by resource_id order by resource_id) xx from 表名 ) a
where a.resource_id = b. resource_id and a.xx = 2 and b.xx = 1)) next_time
from
( select *,row_number() over(partition by resource_id order by resource_id) xx from 表名 ) b
轉載請註明出處,本文鏈接:https://www.uj5u.com/shujuku/229601.html
標籤:應用實例
下一篇:有更簡單的陳述句嗎
