所以我有一个疑问;一个像这样的模拟FULL OUTER JOIN
:
SELECT * FROM SupplierInfo
LEFT JOIN MajorEquipment ON SupplierInfo.SupplierId = MajorEquipment.MEId
UNION
SELECT * FROM SupplierInfo
RIGHT JOIN MajorEquipment ON SupplierInfo.SupplierId = MajorEquipment.MEId;
然而,这拉出了一个相当大的选择,我只需要 2 - 3 个字段:SupplierPartNo
和MajorEquipmentNo
. 我尝试过这样的事情:
SELECT SupplierPartNo, MajorEquipmentNo FROM(
SELECT * FROM SupplierInfo
LEFT JOIN MajorEquipment ON SupplierInfo.SupplierId = MajorEquipment.MEId
UNION
SELECT * FROM SupplierInfo
RIGHT JOIN MajorEquipment ON SupplierInfo.SupplierId = MajorEquipment.MEId
);
但这给了我一个错误Every derived table must have its own alias: SELECT SupplierPartNo, MajorEquipmentNo FROM( SELECT....
我怎样才能SELECT
从以前的选择中做一个?