I am trying to get the sum of a column that is filtered by another column (distinct values of that column). I have tried "group by" "distinct" "with rollup" and many other variations. I have a bunch of columns showing a customer link. Most services have a redundant side, though some don't have redundancy. I am trying to get a bandwidth total for entire "fnn" column but excluding the redundant side value if it exists. If there is redundancy, then it will be indicated by having the same fnn (and same bandwidth value).
I have been struggling with this for ages. Any help would be fantastic. Solution in mysql or php.
my table looks like:
table name = cust_child
id | cust_name |cp_bw|cp_fnn |other_columns
1 | A | 30 | 11 |xxx
2 | A | 30 | 11 |xxx
3 | B |100 | 22 |xxx
4 | B |100 | 22 |xxx
5 | C |50 | 33 |xxx
Result should look like:
Total bandwidth = 180