SELECT
daf.id as affiliate_id,
daf.name as affiliate_name,
dal.name as allocation_name,
dal.id as allocation_id,
dal.allocation,dal.price
FROM
degreeamerica.affiliates daf,degreeamerica.allocations dal
JOIN
(select pap.lead_price,pap.live, pap.allocation_id,pap.affiliate_id from paul.affiliates_price pap) pafp
ON (dal.id=pafp.allocation_id and daf.id=pafp.affiliate_id)
ORDER BY daf.id;
问题:它说on子句中的未知列daf.id,尽管我在字段列表中有此列,请帮助!!!。
最佳答案
JOIN
链在逗号分隔的表之前进行评估。一直切换到显式JOIN
,它将起作用。
SELECT
daf.id as affiliate_id,
daf.name as affiliate_name,
dal.name as allocation_name,
dal.id as allocation_id,
dal.allocation,dal.price
FROM
(select pap.lead_price,pap.live, pap.allocation_id,pap.affiliate_id
from paul.affiliates_price pap) pafp
JOIN
degreeamerica.affiliates daf
ON (daf.id = pafp.affiliate_id)
JOIN
degreeamerica.allocations dal ON
ON (dal.id = pafp.allocation_id)
ORDER BY daf.id;
关于mysql - 未知列问题,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/31247900/