我正在尝试从下一个语句创建一个输出数组:
我有两张 table 。每个表中都有一个起主要作用的“material_code”。我想从 table1 中选择 material_code,它等于 table2 中的 material_code 并将它们连接到 >status(来自表2)等于0。
这就是我到目前为止所得到的。
SELECT material_code FROM table1
LEFT JOIN table2 ON material_code WHERE status IS 0
解决方案:
SELECT material_code FROM table1
LEFT JOIN table2 ON table1.material_code = table2.material_code WHERE status = 0
谢谢大家。
最佳答案
你应该尝试这个:
SELECT
material_code
FROM table1
LEFT JOIN table2
ON table1.material_code = table2.material_code
WHERE status = 0
关于mysql - Select join 语句不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25304596/