我要选择材料表中的所有组件,并选择设备表中的equipment_name。
设备名称与id_material和id_equipment连接。 1种材料可以包含许多设备名称,因此设备也是如此。
我试图在MS Access查询中使用此代码,但显示语法错误(缺少操作数)。
SELECT material.id_material, material.part_number_material, material.material_description,material.brand, material.stock, material.um, equipment.equipment_name, material.type, material.location, material.remarks FROM equipment_list a INNER JOIN material b ON a.PKid_material = b.id_material INNER JOIN equipment c ON a.PKid_equipment = c.id_equipment;
我是初学者。
答案 0 :(得分:0)
如果您使用的是Access,则需要括号以进行三向联接:
SELECT
m.id_material,
m.part_number_material,
m.material_description,
m.brand,
m.stock,
m.um,
e.equipment_name,
m.type,
m.location,
m.remarks
FROM
(equipment_list el INNER JOIN material m
ON el.PKid_material = m.id_material)
INNER JOIN equipment e
ON el.PKid_equipment = e.id_equipment;