Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"Group By *" in a SQL Server 2008 query?

I have a large list of columns in a Select.

To group the result I have to get all the items in the select clause and put in the Group By clause.

I wonder if there's any easy way to get all the items there for reference in GROUP BY, such as a GROUP BY *

How can this be done?

like image 389
LucasCaixeta Avatar asked Jul 15 '26 04:07

LucasCaixeta


1 Answers

The "easy" way is to copy/paste the columns from your SELECT into the GROUP BY. There's no syntactic short cut in SQL for this.

like image 167
Joe Stefanelli Avatar answered Jul 17 '26 17:07

Joe Stefanelli



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!