zee
zee

Reputation: 359

MySQL Selecting Table Excluding Columns Which Sum is equal 0

I need some help with MySQL syntax. I need to SELECT whole table, ignoring columns which SUM = 0...

Is it possible knowing that I can't use the columns names in SQL syntax?

Upvotes: 0

Views: 432

Answers (2)

Marc B
Marc B

Reputation: 360772

You can't do SUM(*). it has to be on a particular column, so you'd have to select sum(a), sum(b), sum(c), etc..., and once you're doing selecting multiple columns with aggregate functions, you'll need to group on all those fields as well.

Upvotes: 1

Jake Kalstad
Jake Kalstad

Reputation: 2065

Not possible, pull down the whole record and through the view code, simply don't display the column if it factors out to 0.

Upvotes: 0

Related Questions