SELECT *
FROM
(SELECT l.DISTRIBUTOR_ID,
d.SKU_CODE,
d.WH_CODE,
d.ORDER_PACKAGES,
d.PRICE,
d.YEARLY||d.MONTHLY as YM
,d.ORDER_PACKAGES * d.PRICE as TN
FROM SIMS_CVO_ORDER_PLAN_LIST l
INNER JOIN SIMS_CVO_ORDER_PLAN_DETAIL d
ON l.seq_id =d.OWNER_SEQ_ID
WHERE l.SEQ_ID =85
) pivot (max(ORDER_PACKAGES),max(TN) tn FOR YM IN ('201911','201912'));
注意:Pivot 多名称必须重命名,如上红色标识。
结果: