MySQL Forums
Forum List  »  MySQL Workbench

Re: GROUP BY is Broken?
Posted by: Peter Brawley
Date: February 19, 2022 09:59AM

Your query ...

select *
from test_table
group by BU,BU_Name,Product,Region,Year,Month;

... has a Group By clause, but calls no aggregating function. What were you hoping to accomplish with this query?

Group By is designed to return exactly one row per unique result of the Group By clause, and is intended to be used with functions which aggregate on such groupings (, for example

select a, sum(b)
from t
group by a;

Consider reading the manual about Group By ...

Edited 1 time(s). Last edit at 02/19/2022 10:24AM by Peter Brawley.

Options: ReplyQuote

Written By
February 19, 2022 09:05AM
February 19, 2022 09:07AM
Re: GROUP BY is Broken?
February 19, 2022 09:59AM

Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.