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 join 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;
pap.lead_price,pap.live,pap.allocation_id,pap.affiliate_id
这些列未显示在结果集中。请帮忙!!!
最佳答案
简短答案
在,pafp.lead_price,pafp.live,pafp.allocation_id,pafp.affiliate_id
之前将Select
添加到From
的末尾
意见建议
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,
pap.lead_price, -- add the fields you want from paul.affiliates_price
pap.live,
pap.allocation_id,
pap.affiliate_id
FROM
degreeamerica.affiliates daf
JOIN degreeamerica.allocations dal -- what are we joining on?
-- why create a subquery with no filters? just join to table.
JOIN paul.affiliates_price pap ON dal.id=pap.allocation_id
and daf.id=pap.affiliate_id
ORDER BY
daf.id
关于mysql - 子查询中的选定列(多列)未显示,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/31169972/