Hi,
I think i'm going thru a complicated formula, i'm not sure if there is an easier way to do it.
I currently have the following code , it works fine
a Code:
SELECT user, sum((a,b))
from (select * FROM xxxxkmain where net>0 ) as aaa
group by user
But now wut i wud like to add to my previous query this :
each user belongs to a department (3 depts in total), so depending on the user dept, i wud like to run different formula(if user is in dep 1 then run formula1.....) <--- this is the formula part
Im sure we will need to use an if statement but i'm not sure how to use it in SQL.
Any tip will e appreciated
thx