Closed (works as designed)
Project:
Views Group By
Version:
6.x-1.0-rc1
Component:
Miscellaneous
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
2 Apr 2009 at 14:36 UTC
Updated:
2 Apr 2009 at 16:19 UTC
Hello,
Why is the COUNT aggregate function compulsory with GROUP BY?
As I understand it is not. For example
I have a table
name,salary,year
SELECT name,salary
FROM employees
GROUP BY name
ORDER BY salary
Will provide me the max salary, kind of like the equivalent of SELECT MAX, but it still works. Just a thought.
Comments
Comment #1
irakli commentedIt's not in MySQL, but it is in PostgreSQL and Views, trying to be cross-DB-compliant is enforcing the constraint, so we can not avoid it, either.
It's not the end of the world though.
Given that unique name always has the same salary (the same person does not have two different salaries) you can just add "salary" to the list of group_by fields and it will give you what you need.