|
|
|
Grasshopper
      
Group: General Forum Members
Last Login: Wednesday, May 15, 2013 3:11 AM
Points: 12,
Visits: 55
|
|
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
|
|
|
|
|
Ten Centuries
      
Group: General Forum Members
Last Login: Yesterday @ 5:32 AM
Points: 1,031,
Visits: 436
|
|
Select a.code, a.price, (price * percent * case when check = 1 then 1 else 8 end) as new_field From a,b Where a.code = b.code ?
|
|
|
|