Question:
So I have this table to see usage report, Let’s say column A B C D E Fif column F has a particular value I want to A + B + C = E else I wanted A + B + C + D = E
My brain can’t handle the logic to be it in SQL query Do I need to use IF ELSE or DECLARE or CAST or idk
Answer:
Here is a possible way to do this; anyway I’d suggest to have a look to theSELECT CASE
documentation since it’s not that complicated (I assumed you’re using sql server):If you have better answer, please add a comment about this, thank you!