Hello,
I am trying to run a query where columns are summed up based on some satisfying condition in Mysql.
for e.g select sum(columnC),sum(columnA) if (coulmnA >500), sum(columnB) if columnB >600 etc.
I cannot use the where clause here because I would not be able to specify
different conditions for different column names.
Is there a feature in Mysql which does contional summing of columns? Or any workarounds for the problem?
Your suggestions will be of great help. This is urgently required for a query.
Thanks and Regards,
Nagi
I am trying to run a query where columns are summed up based on some satisfying condition in Mysql.
for e.g select sum(columnC),sum(columnA) if (coulmnA >500), sum(columnB) if columnB >600 etc.
I cannot use the where clause here because I would not be able to specify
different conditions for different column names.
Is there a feature in Mysql which does contional summing of columns? Or any workarounds for the problem?
Your suggestions will be of great help. This is urgently required for a query.
Thanks and Regards,
Nagi