有人可以向我解释如何在此联接中关联这些名称吗?当我执行时,我得到错误,说明From子句中的对象具有相同的暴露名称
select
inv_mast.item_id as Item,
inv_loc.location_id as location,
company.company_name as company,
vendor_supplier.vendor_id as vendorID
from
inv_loc
join inv_mast on inv_mast.inv_mast_uid = inv_loc.inv_mast_uid
join inv_loc on company.company_id = inv_loc.company_id
JOIN company ON (company.company_id = vendor_supplier.company_id)
答案 0 :(得分:1)
您加入inv_loc
两次 - 您需要修复联接或引入别名,如下所示:
select inv_mast.item_id as Item,
mast.location_id as MasterLocation,
companylocation.location_id as CompanyLocation,
company.company_name as company,
vendor_supplier.vendor_id as vendorID
from inv_loc AS mast
join inv_mast
on inv_mast.inv_mast_uid = mast.inv_mast_uid
join inv_loc AS companylocation
on company.company_id = companylocation.company_id
JOIN company
ON company.company_id = vendor_supplier.company_id