有这样一张表:itemid planid a b c d e f121 365 1、工作方针 实现的方法 2、工作计划 计划如何实施 3、你喜欢什么书 如何去调研在页面上显示的效果为:1、工作方针 实现的方法2、工作计划 计划如何实施3、你喜欢什么书 如何去调研像这种形式该实现呢?
调试欢乐多
select temp.*
(select itemid,planid,a c1,b c2
from table
union
select itemid,planid,c c1,d c2
from table
union
select itemid,planid,e c1,f c2
from table) temp
group by itemid
SQL codeselecttemp.*
(select itemid,planid,a c1,b c2fromtableunionselect itemid,planid,c c1,d c2fromtableunionselect itemid,planid,e c1,f c2fromtable)temp order by itemid