how create sql str with special condition

  • create sql str with special condition

    hellow

    I have 2 table

    Table a(code, price, check)

    Table b(code, percent)

    I want to create a sql string such below:

    Select a.code, a.price, (price * percent) as new_field

    From a,b

    Where a.code = b.code

    And this condition must be consider in sql str:

    If (check = 1)

    {

    New_field = price * percent

    }

    Else

    {

    New_field = price * percent * 8

    }

    Now how can put above condition in sql str?

    Thanks very much

  • Please, do not cross post, duplicate post. Please post all replies here.

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

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