SELECT (select placename from sysloginplace where id = a.YardName) YardNameDisp,
a.YardName,
a.CntrOrUnit2,
count(*) CntrNum,
sum(a.labhourpg) LabHourPg,
sum(a.labhourfp) LabHourFp,
sum(a.cntrlabhourpf) LabHourPf,
sum(a.labhour) LabHour,
sum(a.matcostrmb) MatCostRMB,
sum(a.cntrmatcostpfrmb) MatCostPfRMB
FROM V_PM04_PGTJ a
WHERE (a.CntrRepState in ('02', '03'))
and a.CntrRepState = '02'
and a.IsRentBack = '0'
and a.CntrOrUnit2 = '3'
group by a.YardName, a.CntrOrUnit2
order by a.YardName, a.CntrOrUnit2上面这个语句在10g可以正常执行,但在11g数据库中执行显示报错信息:ora-01427 单行子查询返回多个行
各位如何解决???
a.YardName,
a.CntrOrUnit2,
count(*) CntrNum,
sum(a.labhourpg) LabHourPg,
sum(a.labhourfp) LabHourFp,
sum(a.cntrlabhourpf) LabHourPf,
sum(a.labhour) LabHour,
sum(a.matcostrmb) MatCostRMB,
sum(a.cntrmatcostpfrmb) MatCostPfRMB
FROM V_PM04_PGTJ a
WHERE (a.CntrRepState in ('02', '03'))
and a.CntrRepState = '02'
and a.IsRentBack = '0'
and a.CntrOrUnit2 = '3'
group by a.YardName, a.CntrOrUnit2
order by a.YardName, a.CntrOrUnit2上面这个语句在10g可以正常执行,但在11g数据库中执行显示报错信息:ora-01427 单行子查询返回多个行
各位如何解决???
set后面跟的只能是具体的数据,只能一对一的使用
没用过11g不过报错应该原因都是差不多的
肯定不是 10g和11g的区别,如果说11g的sql在10g上不能执行还算是个正常情况
反过来不太可能,应该是你数据的问题。
建议:(select min(placename) from sysloginplace where id = a.YardName) YardNameDisp
(select max(placename) from sysloginplace where id = a.YardName) YardNameDisp
楼主你的错误信息 应该是这句话报出来的
单独执行一下
select placename from sysloginplace where id = a.YardName
应该返回的是多条数据
Cause: The outer query must use one of the keywords ANY, ALL, IN, or NOT IN to specify values to compare because the subquery returned more than one row.
Action: Use ANY, ALL, IN, or NOT IN to specify which values to compare or reword the query so only one row is retrieved.
也有可能在10g中正常运行是由于数据和11g中的表不一样