if you use GROUP BY, then your SELECT list will have a mix of aggregate expressions like COUNT() and SUM(), as well as non-aggregate expressions or columns
all non-aggregate expressions must then also be listed in the GROUP BY
so to answer your question, if you use "select star" then you must also list all columns in the GROUP BY -- and you cannot use the asterisk in the GROUP BY, you have to list the columns individually
Again, as the prior post stated, the GROUP BY clause is only used when you have aggregate functions like SUM, COUNT, MAX, etc in your SELECT clause like...
SELECT myID, SUM(myamount) as Amt FROM MyTable GROUP BY myID
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.