(SELECT BKCTN.PNUM
FROM BKCTN
WHERE CTNSIZE = '20' AND BO.BOID = BKCTN.BOID(+) ) AS "20",
(SELECT BKCTN.PNUM
FROM BKCTN
WHERE CTNSIZE = '40' AND BO.BOID = BKCTN.BOID(+) ) AS "40",
上面这两个语句里面的查询结果是多行了。
Try this, it should be much more effective than yours
SELECT BO.VESSEL,
BO.VOY,
BO.ETD,
BO.PORTLOAD,
BO.PORTVIA,
BO.PORTDEST,
CASE WHEN CTNSIZE = 20 then BKCTN.PNUM ELSE NULL END,
CASE WHEN CTNSIZE = 40 then BKCTN.PNUM ELSE NULL END,
BO.GWET
FROM BO LEFT JOIN BKCTN ON BO.BOID = BKCTN.BOID