mysql服务器中的select查询语法问题



我在localhost xampp服务器上运行时,有一个从两个表中查询联接选择的查询,它运行得很好,但在域服务器中它不工作,我无法指出错误在哪里

有问题

<b>Fatal error</b>:  Uncaught PDOException: SQLSTATE[42000]: Syntax error or access violation: 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 'LIMIT 3) AS chapname,
GROUP_CONCAT(chapters.chaptername ORDER BY chapters.cha' at line 2 in /home/vol16_1/epizy.com/epiz_29037568/htdocs/includes/functions/function.php:27
Stack trace:
#0 /home/vol16_1/epizy.com/epiz_29037568/htdocs/includes/functions/function.php(27): PDOStatement-&gt;execute()
#1 /home/vol16_1/epizy.com/epiz_29037568/htdocs/index.php(63): getnow()
#2 {main}
thrown in <b>/home/vol16_1/epizy.com/epiz_29037568/htdocs/includes/functions/function.php</b> on line <b>27</b><br />

这是选择查询

SELECT DISTINCT novel.NovelID, novel.NovelName,novel.NovelImage,
GROUP_CONCAT(chapters.chapternumber ORDER BY chapters.chapterID DESC LIMIT 3) AS chapname,
GROUP_CONCAT(chapters.chaptername ORDER BY chapters.chapterid DESC LIMIT 3) AS chpnum,
chapters.chapterID FROM novel INNER JOIN
chapters ON novel.NovelID = chapters.NovelID AND Date(chapters.chapterDate) >= CURDATE()  GROUP BY novel.NovelName

在此处查看文档:https://dev.mysql.com/doc/refman/8.0/en/aggregate-functions.html#function_group-concat

GROUP_CONCAT()函数不支持LIMIT子句。

相关内容

  • 没有找到相关文章

最新更新