MySQL OUTER JOIN语法错误

bn31dyow  于 2023-08-02  发布在  Mysql
关注(0)|答案(3)|浏览(122)

也许你们要捂脸了,但作为一个SQL查询新手,我有一个语法问题。有人知道怎么了吗?

SELECT * FROM company C
OUTER JOIN company_address A ON C.company_id = A.company_id
WHERE A.company_id IS NULL

字符串
给出错误:

#1064 - You have an error in your SQL syntax; check the manual that corresponds 
to your MySQL server version for the right syntax to use near 
'OUTER JOIN company_address A ON C.company_id = A.company_id WHERE A.address_id 
' at line 2

rbpvctlc

rbpvctlc1#

In MySQL应该使用LEFT OUTER JOINRIGHT OUTER JOIN。没有OUTER JOIN。如果你需要FULL OUTER JOIN在MySql you can use UNION of LEFT JOIN and RIGHT JOIN

aydmsdu9

aydmsdu92#

试试看

SELECT * FROM company C
LEFT JOIN company_address A ON C.company_id = A.company_id
WHERE A.company_id IS NULL

字符串

gg0vcinb

gg0vcinb3#

你必须写左联接,右联接,内联接或完整的外联接,而不是只有外联接
您的表名也有一个错误,像这样的表的字母之间不应该有空格[company C-它应该被命名为company_C]
我希望这将是工作..一切顺利!

相关问题