具有多列子查询的SQL cartesion产品,未知列问题

时间:2015-07-02 14:20:12

标签: mysql sql database subquery mysql-workbench

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 我有这个专栏,但它仍然是未知专栏。请帮忙!!!!

1 个答案:

答案 0 :(得分:0)

我相信mySQL你可以通过该字段的别名来订购。

ORDER BY affiliate_id;