MySQL错误问题

MySQL错误问题,mysql,Mysql,我得到下面的错误,并想知道如何才能纠正这个问题 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 'IF(articles_comments.parent_comment_id = articles_comments.comment_id AND users.' at line 4

我得到下面的错误,并想知道如何才能纠正这个问题

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 'IF(articles_comments.parent_comment_id = articles_comments.comment_id AND users.' at line 4
这是我的MySQL代码

SELECT * 
FROM users
INNER JOIN articles_comments ON users.user_id = articles_comments.user_id
IF(articles_comments.parent_comment_id = articles_comments.comment_id AND users.active IS NULL AND users.deletion = 0) AS no
AND users.active IS NULL
AND users.deletion = 0

在这里很难找到您想要做什么,但是为了过滤(设置条件)您的查询,您需要一个
where子句

另外,您的
IF
语句放错了位置

大概是这样的:

SELECT *
  FROM users INNER JOIN articles_comments ON users.user_id = articles_comments.user_id
 WHERE users.active IS NULL
   AND users.deletion = 0

这个问题目前没有意义。。。。我想你把WHERE子句和IF子句弄混了

你的问题也有点模糊,很难理解你想做什么

您的选择*从,连接部分是确定的

您需要使用WHERE子句来代替tho

i、 e


不过,您似乎没有在文章评论表中选择任何内容?对这个问题进行更彻底的解释会有所帮助。

现在我发现这个错误
您的SQL语法有错误;检查与您的MySQL服务器版本对应的手册,了解使用near'AS no AND users.active的正确语法。第1行的near'AS no AND users.DELEATION=0 LIMIT 0,30'
因为您不使用我的查询,我在她身上做了一些其他更改,不仅添加了从头到尾都会出现此错误的地方
您的SQL语法有错误;查看与您的MySQL服务器版本对应的手册,以获取正确的语法,以便在第1行的“用户内部加入文章”注释中使用near')AS no
SELECT * 
FROM users
INNER JOIN articles_comments ON users.user_id = articles_comments.user_id
WHERE (articles_comments.parent_comment_id = articles_comments.comment_id AND users.active IS NULL AND users.deletion = 0)
AND users.active IS NULL
AND users.deletion = 0
SELECT * FROM USERS
INNER JOIN articles_comments ON users.user_id = articles_comments.user_id 
AND articles_comments.parent_comment_id = articles_comments.comment_id 
WHERE users.active IS NULL 
AND users.deletion = 0