Forum Discussion

Tim Hunter's avatar
Tim Hunter
Steel Contributor
Jul 03, 2019

CASE Statement

I am a SQL novice. Our SQL expert is unavailable and I need to make some small changes to a stored procedure, any help would be appreciated.

 

So I have a stored procedure that pulls the data into an Excel spreadsheet. Here is what the output looks like:

 

What I am trying to accomplish is when the % is 0 or the Incentive is blank, I want the Pay column to be a 0. Attached is the query for the stored procedure. At the end of the code, you will see the CASE statements for the columns. Thank you!!

 

 

 

 

  • thanos7's avatar
    thanos7
    Copper Contributor

    Tim Hunter 

    You can use a case statement in Pay column something like that

     

     

    case when (se <1 or ty =3 or yr =0 or st ='OUT')
    then 0 else py
    end

     

     

Resources