Nesting an If Statement in a Select

  • Below is my select statement...what I'd like to do is to add a column to the select statement, that is an if statement of sorts so using our select statment below, we would calculate 5% of the amount column and the the result is greater than 50...then compute the something...if it's greater than 40 do another computation...is this possible?

    select custid, companyname, invdate, txnref, amount, costofsales

    from Whatever

    where salesrep = 'Brian' and

    amount is not null

    order by invdate

  • That sound like a job for a CASE expression.

    --Jonathan



    --Jonathan

  • No sooner had I posted this, than I figured out that I should use a CASE Statement. I think I have it down. Thanks!

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply