gpt4 book ai didi

sql - 尝试用 mysql 连接 4 个表

转载 作者:行者123 更新时间:2023-11-29 01:00:20 25 4
gpt4 key购买 nike

我正在尝试连接 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

最佳答案

advancedcatalog_dimensions.font_size_id 不存在,您在第二个查询中引用了它。

关于sql - 尝试用 mysql 连接 4 个表,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3728640/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com