SrNo Name Amount ApplyTax 1 John 500 Yes 2 Peter 700 No 3 Tom 900 Yes
SrNo Name Amount Tax 1 John 500 100 2 Peter 700 0 3 Tom 900 180
select SrNo,Name,Amount,case when ApplyTax='Yes' then (Amount*0.2) else 0 end as Tax from Table
20% Amount = (Amount/100)*20
Case
select SrNo,name ,Amount,case when ApplyTax='Yes' then (Amount*20)/100 when ApplyTax='No' then 0 end as Tax From table_name
SELECT SrNo, Name, Amount, CASE WHEN ApplyTax='Yes' THEN (Amount * 20) / 100 ELSE 0 END AS Tax FROM MyTable
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)