Reputation: 359
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
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
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