Skip to content
Advertisement

Where to use WHERE clause in this query?

I want only results WHERE COUNT = 0, but every way I tried making this query it failed. Please help!

Advertisement

Answer

Use HAVING. For example:

HAVING filters “resulting rows” after they are aggregated. WHERE, on the other side, filters rows before they are aggregated.

Or… you can use an anti-join:

User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement