SELECT * FROM gh_zd_scjx sj
--ghdm_id 可以随意名称--scjxdm,scjxmc 表中需要字段--unpivot 关键字(把列的位置转换成行) -- ghdm_id(随意名称) for(关键字) ghid(随意名称)-- in(zgghdm,ghdm2,ghdm1)表中字段SELECT ghdm_id,scjxdm,scjxmc FROM gh_zd_scjx sj unpivot (ghdm_id for ghid in(zgghdm,ghdm2,ghdm1) )