2 zsg20130322 zsg20130322 于 2013.12.20 10:49 提问

帮忙简化SQL oracle用varchar2(4000)储存

select trim(a.taskno) taskno,
(select QR540 from prj_wlw where taskno=a.taskno and WORKPROP='1' and worktype='1') QR540,(select QR540 from prj_wlw where taskno=a.taskno and WORKPROP='1' and worktype='2') QR540,
(select QR540 from prj_wlw where taskno=a.taskno and WORKPROP='2' and worktype='1') QR540,(select QR540 from prj_wlw where taskno=a.taskno and WORKPROP='2' and worktype='2') QR540,
(select QR540 from prj_wlw where taskno=a.taskno and WORKPROP='3' and worktype='1') QR540,(select QR540 from prj_wlw where taskno=a.taskno and WORKPROP='3'and worktype='2') QR540,
(select RAYLEN from prj_wlw where taskno=a.taskno and WORKPROP='1' and worktype='1') RAYLEN,(select RAYLEN from prj_wlw where taskno=a.taskno and WORKPROP='1' and worktype='2') RAYLEN,
(select RAYLEN from prj_wlw where taskno=a.taskno and WORKPROP='2' and worktype='1') RAYLEN,(select RAYLEN from prj_wlw where taskno=a.taskno and WORKPROP='2' and worktype='2') RAYLEN,
(select RAYLEN from prj_wlw where taskno=a.taskno and WORKPROP='3' and worktype='1') RAYLEN,(select RAYLEN from prj_wlw where taskno=a.taskno and WORKPROP='3'and worktype='2') RAYLEN,
(select WIRELEN from prj_wlw where taskno=a.taskno and WORKPROP='1' and worktype='1') WIRELEN,(select WIRELEN from prj_wlw where taskno=a.taskno and WORKPROP='1' and worktype='2') WIRELEN,
(select WIRELEN from prj_wlw where taskno=a.taskno and WORKPROP='2' and worktype='1') WIRELEN,(select WIRELEN from prj_wlw where taskno=a.taskno and WORKPROP='2' and worktype='2') WIRELEN,
(select WIRELEN from prj_wlw where taskno=a.taskno and WORKPROP='3' and worktype='1') WIRELEN,(select WIRELEN from prj_wlw where taskno=a.taskno and WORKPROP='3'and worktype='2') WIRELEN,
(select TWIST from prj_wlw where taskno=a.taskno and WORKPROP='1' and worktype='1') TWIST,(select TWIST from prj_wlw where taskno=a.taskno and WORKPROP='1' and worktype='2') TWIST,
(select TWIST from prj_wlw where taskno=a.taskno and WORKPROP='2' and worktype='1') TWIST,(select TWIST from prj_wlw where taskno=a.taskno and WORKPROP='2' and worktype='2') TWIST,
(select TWIST from prj_wlw where taskno=a.taskno and WORKPROP='3' and worktype='1') TWIST,(select TWIST from prj_wlw where taskno=a.taskno and WORKPROP='3'and worktype='2') TWIST,
(select REPEATCABLE from prj_wlw where taskno=a.taskno and WORKPROP='1' and worktype='1') REPEATCABLE,(select REPEATCABLE from prj_wlw where taskno=a.taskno and WORKPROP='1' and worktype='2') REPEATCABLE,
(select REPEATCABLE from prj_wlw where taskno=a.taskno and WORKPROP='2' and worktype='1') REPEATCABLE,(select REPEATCABLE from prj_wlw where taskno=a.taskno and WORKPROP='2' and worktype='2') REPEATCABLE,
(select REPEATCABLE from prj_wlw where taskno=a.taskno and WORKPROP='3' and worktype='1') REPEATCABLE,(select REPEATCABLE from prj_wlw where taskno=a.taskno and WORKPROP='3'and worktype='2') REPEATCABLE,
from (select distinct taskno from prj_wlw) a order by a.taskno desc

Csdn user default icon
上传中...
上传图片
插入图片
准确详细的回答,更有利于被提问者采纳,从而获得C币。复制、灌水、广告等回答会被删除,是时候展现真正的技术了!