MySQL错误1064

时间:2015-01-13 15:01:58

标签: php mysql

我在Oracle中编写了此代码,但将其放入MySQL我收到错误。

SQL查询:文档

            Select idan
            From Certificare
            Having count(idav)=3
            Group by idan
            LIMIT 0, 25 

MySQL说:文档

#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 'Group by {idan} LIMIT 0, 25' at line 4 strong text

2 个答案:

答案 0 :(得分:2)

GROUP BYHAVING之前发生,这就是您收到错误的原因。

答案 1 :(得分:0)

尝试此查询

Select `idan`
From `Certificare`
Group by `idan`
Having count(`idav`)=3
LIMIT 0, 25

GROUP BY应该出现在Having

之前