When should I be using the HAVING clause in SQL Server?

All topics about programming / development in T-SQL or other languages for SQL Server.
Post Reply
Tilly
Posts: 8
Joined: Wed Jun 26, 2019 4:49 pm

Wed Jul 10, 2019 5:00 pm

Hi All, When should I be using the HAVING clause in SQL Server?
Admin2
Site Admin
Posts: 7
Joined: Thu Jun 20, 2019 3:53 pm

Wed Jul 10, 2019 5:02 pm

Hi @Tilly

HAVING filters records that work on summarized GROUP BY results.

HAVING applies to summarized group records, whereas WHERE applies to individual records.

Only the groups that meet the HAVING criteria will be returned.

HAVING requires that a GROUP BY clause is present.

WHERE and HAVING can be in the same query.
Post Reply

Social Media