Such as this one:
SELECT id, count( * ) , company
FROM jobs
GROUP BY company
Where id is the primary key of jobs
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Similar question:
Why does MySQL allow "group by" queries WITHOUT aggregate functions?
This is MySQL specific, and is not ANSI standard SQL. Most other database engines do not allow columns on which is not being grouped or being run through an aggregate function.
It seems MySQL retains the value of the first row that matches the criteria.
The aggregate function that has this behaviour is FIRST(), and although MySQL implements it, this seems to be default behaviour for columns that are not grouped on, and which are not run through any other aggregate function.
In ANSI standard SQL you would do:
Whereas in MySQL you could just (however the ANSI standard works just aswell):