現有資料如下:

select a.MODELID,
max( case a.PNAME when'計劃開始' then a.PVALUE end) as RStart,
max( case a.PNAME when '計劃結束' then a.PVALUE end) as Rend
from TB_CONSTRUCTION_PROPERTY as a
group by a.MODELID
結果: