Mike B.
Mike B.

Reputation: 143

MySQL Error 1064

I wrote this code in Oracle, but putting it in MySQL i get an error.

SQL query: Documentation

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

MySQL said: Documentation

#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

Upvotes: 0

Views: 65

Answers (2)

Gunaseelan
Gunaseelan

Reputation: 2542

Try this query

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

GROUP BY should come before Having

Upvotes: 0

user1897253
user1897253

Reputation:

GROUP BY goes before HAVING, that's why you get an error.

Upvotes: 2

Related Questions