``++HAVING++`` was introduced to limit the result set after selection because ``++WHERE++`` clause conditions cannot be used on aggregated values. ``++HAVING++`` conditions that don't operate on aggregated values can safely be moved into the ``++WHERE++`` clause for increased efficiency. == Noncompliant Code Example [source,text] ---- SELECT p.id, p.name, count(o.id) FROM product p JOIN order_row o on p.id=o.product_id GROUP BY p.id HAVING count(o.id) > 10 p.name like "t-shirt%" -- Noncompliant ---- == Compliant Solution [source,text] ---- SELECT p.id, p.name, count(o.id) FROM product p JOIN order_row o on p.id=o.product_id WHERE p.name like "t-shirt%" GROUP BY p.id HAVING count(o.id) > 10 ----