interesting having clause eg

PHOTO EMBED

Wed Aug 10 2022 05:13:02 GMT+0000 (UTC)

Saved by @vnmshenoy

select  last_name,first_name,Count(distinct year) as years
from employees
group by last_name,first_name
having years>2

content_copyCOPY

see how distinct is used. I was trying to calculate current year by using YEAR(GETDATE())

https://learnsql.com/track/sql-from-a-to-z/course/sql-queries/order-by-group-by/having/having