Skip to content
Advertisement

Remove zero amount in a query

I have a table finalData with the following columns and data

I am creating mysql query to display the income and expenses of Singapore per Area, but I have to exclude areas that has zero amount. Here’s the code I tried:

Output should be like this

Any help would be appreciated. Thanks

Advertisement

Answer

This logic would be simpler phrased with conditionl aggregation. As for filtering out 0 amounts, I am speculating that you just want a where clause:

If, on the other hand, you want to filter on one of the two amounts, then you can use a having clause. Say you want to filter out 0 revenues, regardless of the expenses, then would add the following expression at the end of your code:

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