Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
eem_2055
Yak Posting Veteran
69 Posts |
Posted - 2008-05-15 : 09:40:39
|
| how can I use If Statement given the following:this is the situationif Present Balance > 2500then Control Amount = 2500if Present Balance < 2500then Control Amount = control amountBalance Control Amount 2,000.00 2,500.00 3,000.00 4,500.00 What query can I use to get this table? Balance Control Amount 2,000.00 2,000.00 2,500.00 2,500.00 3,000.00 2,500.00 4,500.00 2,500.00 Thanks,,:) |
|
|
harsh_athalye
Master Smack Fu Yak Hacker
5581 Posts |
Posted - 2008-05-15 : 09:48:38
|
| [code]Select Balance, Case when Balance > 2500 then 2500 else balance as ControlAmountfrom table[/code]Harsh AthalyeIndia."The IMPOSSIBLE is often UNTRIED" |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-05-15 : 10:14:58
|
quote: Originally posted by harsh_athalye
Select Balance, Case when Balance > 2500 then 2500 else balance end as ControlAmountfrom table Harsh AthalyeIndia."The IMPOSSIBLE is often UNTRIED"
missed end clause |
 |
|
|
harsh_athalye
Master Smack Fu Yak Hacker
5581 Posts |
Posted - 2008-05-15 : 10:16:58
|
Thanks Visakh! Harsh AthalyeIndia."The IMPOSSIBLE is often UNTRIED" |
 |
|
|
|
|
|
|
|