Quantcast
Channel: Excel IT Pro Discussions forum
Viewing all articles
Browse latest Browse all 11829

If statement in MS Query

$
0
0

Hi there,

I am trying to create an if statement in ms query that will create an additional column where column B is multiplied by one of two possible amounts based on value in column A. Here is my example.

MAJOR_ACCT       CC_VOL

OIL                     5.0

NGL                    5.0

COND                 5.0

GAS                    20.0

What my if statement needs to say is if MAJOR_ACCT is equal to GAS, CC_VOL * 35.49373/6 and if MAJOR_ACCT is not equal to GAS, CC_VOL*6.29287.

Here is my sql statement without the if statement in it.

SELECT CC_ACTUALS.MAJOR_ACCT, CC_ACTUALS.CC_ACTUAL_VOL
FROM QBYTE.CC_ACTUALS CC_ACTUALS
WHERE (CC_ACTUALS.MAJOR_ACCT In ('OIL','GAS','NGL','COND'))

Any help with this would be greatly appreciated!!

Thanks,

Dave


Viewing all articles
Browse latest Browse all 11829

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>