Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialAdam Zuckerberg
22,248 PointsHAVING can use an alias?
The alias "average" is used in the HAVING clause. I thought you couldn't use the alias? Is HAVING an exception - can you always use an alias in a HAVING clause but you can't use an alias in COUNT etc.
What is the general rule with aliases?
1 Answer
Jose Soto
23,407 PointsMySQL allows using aliases in GROUP BY, ORDER BY, and HAVING. You usually utilize HAVING with a GROUP BY clause. You would use WHERE before the GROUP BY clause and HAVING after it.