有朋友問「如何直接unpivot成2個欄位」,如下所示, 先準備測試資料如下, view source print? 01 create table T ( 02 no varchar(10), 03 yearx varchar(4), 04 z_type varchar(1), 05 A01 smallint, 06 B01 smallint, 07 A02 smallint, 08 B02 smallint, 09 A03 smallint, 10 B03 smallint 11 ) 12…