Shrikant Jadhav
Shrikant Jadhav

Reputation: 176

Mysql : Aggregation function is not working without group by

I am using following query

SELECT count(*) as num,id,page_name FROM project_page where p_id = '256'

this query is running fine on mysql version 5.1.49-3 and giving error on mysql 5.0.32-Debian_7etch8-log On both server i have exactly same database.

error message

#1140 - Mixing of GROUP columns (MIN(),MAX(),COUNT(),...) with no GROUP columns is illegal if there is no GROUP BY clause

How do i run the above query on 5.0.31 without any error

Please help.

Upvotes: 0

Views: 753

Answers (1)

Mark
Mark

Reputation: 8431

Add ... GROUP BY num, id, page_name

Upvotes: 1

Related Questions