从加入中选择时出错

时间:2014-04-11 09:37:44

标签: mysql

有谁知道我从这个查询中收到错误的原因:

SELECT COUNT(*) 
FROM individual AS i LEFT JOIN establishment AS e USING establishment_id
WHERE i.bla = e.bla;

mysql-workbench在第1行的establishment_id下给了一条波浪线,并报告了语法错误,但我不确定为什么会收到此错误。

2 个答案:

答案 0 :(得分:2)

我认为你需要括号:

SELECT COUNT(*) 
FROM individual AS i LEFT JOIN establishment AS e USING (establishment_id)
WHERE i.bla = e.bla;

答案 1 :(得分:0)

试试这个

SELECT COUNT(*) 
FROM individual AS i LEFT JOIN establishment AS e USING establishment_id
on i.bla = e.bla;