SQLTeam.com | Weblogs | Forums

Excluding columns from results if they meet a condition


For the following table:

--ABC --123 street--1976--0--
--DEF --456 street--1979--0--
--GHI --111 street--1980--0--

Assuming that you have to select Month to calculate if it sums to zero...
How can I query the table and not return month if it sums to 0?


Don't fully understand your q.

But in general, you can use HAVING to verify that a SUM() is > 0 or the group will be dropped from the query result.