我正在尝试加入4个表但有问题。我的代码列在下面。
我收到的错误是
#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 'ON advancedcatalog_font_type.id = advancedcatalog_dimensions.font_type_id) LEFT ' at line 6
id |letter_id | font_type_id | font_size_id | dimensions | LED
----------------------------------------------------------------------------------------------
1 | | | | |
2 | | | | |
3 | | | | |
4 | | | | |
id |font_size |
--------------------------
1 | |
2 | |
3 | |
4 | |
id |font_name |
--------------------------
1 | |
2 | |
3 | |
4 | |
id |casing | letter |
------------------------------------------------
1 | | |
2 | | |
3 | | |
4 | | |
查询有效:
SELECT advancedcatalog_letter.letter,
advancedcatalog_dimensions.dimensions,
advancedcatalog_font_type.font_name
FROM (advancedcatalog_dimensions
LEFT JOIN advancedcatalog_letter ON advancedcatalog_dimensions.letter_id = advancedcatalog_letter.id)
LEFT JOIN advancedcatalog_font_type ON advancedcatalog_font_type.id = advancedcatalog_dimensions.font_type_id
LIMIT 0 , 400
NOT 的查询工作:
SELECT advancedcatalog_letter.letter,
advancedcatalog_dimensions.dimensions,
advancedcatalog_font_type.font_name
FROM (advancedcatalog_dimensions
LEFT JOIN advancedcatalog_letter ON advancedcatalog_dimensions.letter_id = advancedcatalog_letter.id)
LEFT JOIN (advancedcatalog_font_type ON advancedcatalog_font_type.id = advancedcatalog_dimensions.font_type_id)
LEFT JOIN advancedcatalog_font_size ON advancedcatalog_font_size.id = advancedcatalog_dimensions.font_size_id
答案 0 :(得分:1)
advancedcatalog_dimensions.font_size_id
不存在,您在第二个查询中引用它。