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 |
|
JustStrolling
Starting Member
15 Posts |
Posted - 2007-10-16 : 07:38:37
|
I want to take the column values (same table, same row) only if the 'Bit' column for that column is true... and then mulitply it by the column 'Multiplier'.For instance:A1 ABit B1 BBit Multiplier5 True 10 False 1.010 True 15 True 1.0 The result I am looking for in each row would be:515I tried segmenting it up using Aliases and the IIF statement which worked fine. But then I found I can not use Aliases in my arithmetic, so how do I do this?*Thanks* |
|
|
harsh_athalye
Master Smack Fu Yak Hacker
5581 Posts |
Posted - 2007-10-16 : 07:40:15
|
| IIF? are you using MS Access?Harsh AthalyeIndia."The IMPOSSIBLE is often UNTRIED" |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2007-10-16 : 07:54:52
|
SELECT CASE WHEN BBit = True THEN B1 WHEN ABit = True THEN A1 END * MultiplierFROM Table1 E 12°55'05.25"N 56°04'39.16" |
 |
|
|
JustStrolling
Starting Member
15 Posts |
Posted - 2007-10-17 : 04:34:06
|
| Hello harsh_athalye,No, although I actually tried it in Access first and then went to .Net.The Aliases were stopping me and I just didn't know quite how to do this without them. Initially I was looking at IIF and Coalesce. Excellent Peso...Got it to work with my INNER JOINS also*Thanks* |
 |
|
|
|
|
|