这是我的 mysql 查询。我收到以下错误。如何解决?
select
p.P3_WOTypeId,
p.P3_WOId,
p3_WoNo,
p3_wotype.P3_WOType,
case when((
SELECT P3_SubmissionCount
from p3_woqmsmaster
where p3_woqmsmaster.P3_WOID = P3_WOID
and P3_ReviewType = P3_WOStatusDescription
and p.P3_WODisplay = 1
order by P3_QMSId desc limit 1
)) > 1
then concat(p3_wostatusmaster.P3_WOStatusDescription,'_Rework')
else p3_wostatusmaster.P3_WOStatusDescription
End As P3_WOStatusDescription
from p3_womaster p
Join p3_wotype on (p3_wotype.P3_WOTypeId = p.p3_WoTypeId)
where p.p3_WODisplay = 1
and p.P3_workTemplateId ='19'
and P3_WOId IN(
select DISTINCT P3_WOId
from p3_woqmsmaster
where P3_SubmissionCount > 1
)
and p.p3_wostatusId in (2,3)
我遇到以下错误
Error Code: 1247. Reference 'P3_WOStatusDescription' not supported (forward reference in item list) 0.000 sec
如何解决?
最佳答案
您在 case
语句中引用了 p3_wostatusmaster.P3_WOStatusDescription
,但您从未加入 p3_wostatusmaster
。加入 p3_wostatusmaster
。
关于mysql - 如何解决mysql中的前向引用?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53096885/