使用 phpmyadmin 的 mySQL 的 INNER JOIN 语法
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/2926251/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
INNER JOIN syntax for mySQL using phpmyadmin
提问by David van Dugteren
SELECT Question.userid, user.uid
FROM `question`
WHERE NOT `userid`=2
LIMIT 0, 60
INNER JOIN `user`
ON `question`.userid=`user`.uid
ORDER BY `question`.userid
returns Error:
返回错误:
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 'INNER JOIN User
ON question
.userid=user
.uid ORDER BY question
.userid' at line 5
您的 SQL 语法有错误;检查与您的 MySQL 服务器版本相对应的手册,了解在第 5 行的“INNER JOIN User
ON question
.userid= user
.uid ORDER BY question
.userid”附近使用的正确语法
Can't for the life of me figure out what I'm doing wrong here.
不能为我的生活弄清楚我在这里做错了什么。
回答by Daniel Vassallo
Your query doesn't look valid. You may want to try the following:
您的查询看起来无效。您可能想尝试以下操作:
SELECT `question`.userid, `user`.uid
FROM `question`
INNER JOIN `user` ON `question`.userid = `user`.uid
WHERE `userid` <> 2
ORDER BY `question`.userid
LIMIT 0, 60