我试图从2个具有相同列的表中进行选择,但两个表都有内连接 -
select e.ID,
c.FullName,
car.VIN,
car.Registration,
e.Telephone,
e.Mobile,
e.Email,
e.EstimateTotal,
e.LastUpdated,
e.LastUpdateBy from (select id from Estimates UNION ALL select id from PrivateEstimates) e
inner join Customers c on c.ID = e.CustomerID
inner join Cars car on car.ID = e.CarID
where e.Status = 0
麻烦的是,它在内连接上找不到e.CustomerID,e.CarID或e.Status?有什么想法吗?
答案 0 :(得分:3)
您的子查询
select id from Estimates
union all
select id from PrivateEstimates
只返回一个id
列。如果要在JOIN
语句