select ORA-01427 :单行子查询返回多行 5
SELECTBO.VESSEL,BO.VOY,BO.ETD,BO.PORTLOAD,BO.PORTVIA,BO.PORTDEST,(SELECTBKCTN.PNUMFRO...
SELECT BO.VESSEL,
BO.VOY,
BO.ETD,
BO.PORTLOAD,
BO.PORTVIA,
BO.PORTDEST,
(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",
BO.GWET
FROM BO 展开
BO.VOY,
BO.ETD,
BO.PORTLOAD,
BO.PORTVIA,
BO.PORTDEST,
(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",
BO.GWET
FROM BO 展开
3个回答
展开全部
(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",
上面这两个语句里面的查询结果是多行了。
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
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
本回答被网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
说明你的子查询返回的数据不止一条数据,而是多条数据库,
先检查下你的子查询结果是几条数据
先检查下你的子查询结果是几条数据
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询