CASE statement to subtract percent value from column

I have to subtract 11.5 percent from the STDCOST column in Table IV00101 if the CUSTCLSID  is equal to SD or PD or CF otherwise leave it as is. Would I use a case statement to to that if so how would  it be formatted, any help would be greatly appreciated.
skull52Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

käµfm³d 👽Commented:
Could it not be?
SELECT stdcost - (.115 * stdcost)
FROM iv00101
WHERE custclsid in ('SD', 'PD', 'CF')

Open in new window

0
käµfm³d 👽Commented:
Never mind the above...   I think I misinterpreted the requirement.
0
käµfm³d 👽Commented:
I can't test this ATM, but modifying the above:
SELECT CASE
           WHEN custclsid IN ('SD', 'PD', 'CF') THEN stdcost - (.115 * stdcost)
           ELSE stdcost
       END
FROM iv00101

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Cloud Class® Course: Certified Penetration Testing

This CPTE Certified Penetration Testing Engineer course covers everything you need to know about becoming a Certified Penetration Testing Engineer. Career Path: Professional roles include Ethical Hackers, Security Consultants, System Administrators, and Chief Security Officers.

Anthony PerkinsCommented:
Or simply (no points please):
WHEN CUSTCLSID  IN ('SD', 'PD', 'CF') THEN STDCOST * .885
0
SharathData EngineerCommented:
To complete acperkins CASE statement.
SELECT CASE 
         WHEN CUSTCLSID IN ('SD','PD','CF') THEN STDCOST * .885 
         ELSE STDCOST 
       END AS Dervied_STDCOST 
FROM   IV00101

Open in new window

0
käµfm³d 👽Commented:
I read "subtract" in the original question. Perhaps I'm missing something, but simply putting

STDCOST * .885

Open in new window


wouldn't give the value after subtracting 11.5%; rather it would give the value of 11.5%. Did I overlook something?
0
käµfm³d 👽Commented:
Oops!

Never mind. I see what you guys did  = )
0
skull52Author Commented:
Thanks to you all, acperkins could you explain how you derived .885 from 11.5%  
0
Anthony PerkinsCommented:
If you subtract 11.5% from 100% you get 88.5%, in other words: .885
0
Anthony PerkinsCommented:
Or if you recall your days at school:
Given x is the standard cost than:
x - (0.115 * x) = x - 0.115x = .885x
0
skull52Author Commented:
Well don't I feel stupid, I can barely remember yesterday let alone when I was last in school ;-)

Thanks
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft SQL Server 2005

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.