gpt4 book ai didi

mysql - 使用mysql将表与自身连接

转载 作者:太空宇宙 更新时间:2023-11-03 11:37:42 25 4
gpt4 key购买 nike

当我在 phpmyadmin 上使用 mariadb 服务器在 mysql 上编写此行时,在 a.cpid = b.cid 附近出现意外错误

select a.cid, a.cname as 'cname', b.cname as 'pname'
from categories as a left OUTER JOIN as b ON a.cpid = b.cid

MySQL said:
#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'as b ON a.cpid = b.cid LIMIT 0, 25' at line 1

最佳答案

您缺少表名(下面的第二类):

select a.cid, a.cname as 'cname', b.cname as 'pname' 
from categories as a
left OUTER JOIN categories as b ON a.cpid = b.cid

关于mysql - 使用mysql将表与自身连接,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44323987/

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