Search code examples
sqlsql-serverif-statementcase-statement

How can I make an case statement to set a cash cap for a particular person in sql?


So I am working on a compensation report and one of the requirements is that One particular person has a different cash cap than everyone else. My solution was instead of making a parameter I want to make a query that the output is dependent on the person. EX) if person= particular person than cash cap = 15,000 otherwise cash cap=10000. This is what I have so far but it gives me an error.

[my code]

enter image description here

error message

enter image description here

I'm not sure how to fix this syntax issue. Im still new to sql so Im not too sure.


Solution

  • Just declare the expression :

    (case when mc = 'shaun meller' then 15000 else 10000 end) as cashcap