Hi,
I want to use the sum function to get the sum of a * b where a is always the value of the "face" column but b can be the value from one of 2 columns dependent on a certain condition. So simply my SQL would look like this if b was a fixed column:
select sum(a*b)
from tableA, tableB....
What is the best way to add logic to this. Basically, below is what I want to do:
select sum(a * [if tableA.code = 1 then use tableA.rate Else use tableB.rate])
from tableA, tableB
I hope I have explained this properly.
Regards,
Wallace