Skip to content
Advertisement

How to hide rows where aggregate functions are used

let’s imagine here is my report:

Output:

If e.g. i want to hide part of the report in an easy way I simply add 1 = 2 to where clause:

Output:

Cool! However, when select uses aggregate functions, this trick does not help. The row is generated anyway:

Output:

Someone maybe know a simple, easy way to hide such rows?

Advertisement

Answer

An aggregation query with no group by always returns exactly one row — even if no rows are being aggregated.

You want to filter after the aggregation, so use having:

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