I need a value in a field regardless of the true false statement.

I need a value in a field regardless of the true false statement.
This is telling me i have the field  "Expected_Value" listed to many times..

CASE WHEN( MCD.Freight_GIS = 'Prepaid on A.com Orders (PPG)' AND mcd.contract_number LIKE '%NCP%' AND (Sum_Of_Sales_Current < 50000 OR Sum_Of_Sales_Current IS NULL  ) )THEN '$50,000' ELSE '$50,000' END AS Expected_Volume,
CASE WHEN( MCD.Freight_GIS = 'Prepaid (PPD)' AND mcd.contract_number like'%NCP%' AND (Sum_Of_Sales_Current < 250000 OR Sum_Of_Sales_Current IS NULL  ) )THEN '$250,000' ELSE '$50,000' END AS Expected_Volume,
CASE WHEN( MCD.Freight_GIS = 'Prepaid Parcel (PPP)' AND mcd.contract_number LIKE '%NCP%' AND (Sum_Of_Sales_Current < 50000 OR Sum_Of_Sales_Current IS NULL  ) )THEN '$50,000' ELSE '$50,000' END AS Expected_Volume,
CASE WHEN( MCD.Freight_GIS = 'Prepaid Parcel on G.com Orders (PPPG)' AND mcd.contract_number LIKE '%NCP%' AND (Sum_Of_Sales_Current < 100000 OR Sum_Of_Sales_Current IS NULL  ) )THEN '$100,000' ELSE '$50,000' END AS Expected_Volume, 
CASE WHEN( MCD.Freight_GIS = 'Standard (PPA)' AND mcd.contract_number LIKE '%NCP%' AND (Sum_Of_Sales_Current < 50000 OR Sum_Of_Sales_Current IS NULL  ) )THEN '$50,000' ELSE '$50,000' END AS Expected_Volume  

Open in new window



so even if the First CASE is false i still need the ELSE part to populate with   '$50,000'
etc...with the others




Thanks
fordraiders
LVL 3
FordraidersAsked:
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.

Scott PletcherSenior DBACommented:
You just can't use the exact same column name over and over:

CASE WHEN( MCD.Freight_GIS = 'Prepaid on A.com Orders (PPG)' AND mcd.contract_number LIKE '%NCP%' AND (Sum_Of_Sales_Current < 50000 OR Sum_Of_Sales_Current IS NULL  ) )THEN '$50,000' ELSE '$50,000' END AS Expected_Volume_PPG,
CASE WHEN( MCD.Freight_GIS = 'Prepaid (PPD)' AND mcd.contract_number like'%NCP%' AND (Sum_Of_Sales_Current < 250000 OR Sum_Of_Sales_Current IS NULL  ) )THEN '$250,000' ELSE '$50,000' END AS Expected_Volume_PPD,
CASE WHEN( MCD.Freight_GIS = 'Prepaid Parcel (PPP)' AND mcd.contract_number LIKE '%NCP%' AND (Sum_Of_Sales_Current < 50000 OR Sum_Of_Sales_Current IS NULL  ) )THEN '$50,000' ELSE '$50,000' END AS Expected_Volume_PPP,
CASE WHEN( MCD.Freight_GIS = 'Prepaid Parcel on G.com Orders (PPPG)' AND mcd.contract_number LIKE '%NCP%' AND (Sum_Of_Sales_Current < 100000 OR Sum_Of_Sales_Current IS NULL  ) )THEN '$100,000' ELSE '$50,000' END AS Expected_Volume_PPPG,
CASE WHEN( MCD.Freight_GIS = 'Standard (PPA)' AND mcd.contract_number LIKE '%NCP%' AND (Sum_Of_Sales_Current < 50000 OR Sum_Of_Sales_Current IS NULL  ) )THEN '$50,000' ELSE '$50,000' END AS Expected_Volume_PPA
Sam JacobsDirector of Technology Development, IPMCommented:
Your CASE statement should be:
CASE WHEN( MCD.Freight_GIS = 'Prepaid on A.com Orders (PPG)' AND mcd.contract_number LIKE '%NCP%' AND (Sum_Of_Sales_Current < 50000 OR Sum_Of_Sales_Current IS NULL  ) ) THEN '$50,000'
         WHEN( MCD.Freight_GIS = 'Prepaid (PPD)' AND mcd.contract_number like'%NCP%' AND (Sum_Of_Sales_Current < 250000 OR Sum_Of_Sales_Current IS NULL  ) ) THEN '$250,000'
         WHEN( MCD.Freight_GIS = 'Prepaid Parcel (PPP)' AND mcd.contract_number LIKE '%NCP%' AND (Sum_Of_Sales_Current < 50000 OR Sum_Of_Sales_Current IS NULL  ) ) THEN '$50,000' 
         WHEN( MCD.Freight_GIS = 'Prepaid Parcel on G.com Orders (PPPG)' AND mcd.contract_number LIKE '%NCP%' AND (Sum_Of_Sales_Current < 100000 OR Sum_Of_Sales_Current IS NULL  ) ) THEN '$100,000' 
         WHEN( MCD.Freight_GIS = 'Standard (PPA)' AND mcd.contract_number LIKE '%NCP%' AND (Sum_Of_Sales_Current < 50000 OR Sum_Of_Sales_Current IS NULL  ) ) THEN '$50,000' 
ELSE '$50,000' END AS Expected_Volume

Open in new window

Doug BishopDatabase DeveloperCommented:
Rewrite as:
CASE	WHEN( MCD.Freight_GIS = 'Prepaid on A.com Orders (PPG)' AND mcd.contract_number LIKE '%NCP%' AND (Sum_Of_Sales_Current < 50000 OR Sum_Of_Sales_Current IS NULL  ) )THEN '$50,000' 
		WHEN( MCD.Freight_GIS = 'Prepaid (PPD)' AND mcd.contract_number like'%NCP%' AND (Sum_Of_Sales_Current < 250000 OR Sum_Of_Sales_Current IS NULL  ) )THEN '$250,000' 
		WHEN( MCD.Freight_GIS = 'Prepaid Parcel (PPP)' AND mcd.contract_number LIKE '%NCP%' AND (Sum_Of_Sales_Current < 50000 OR Sum_Of_Sales_Current IS NULL  ) )THEN '$50,000' 
		WHEN( MCD.Freight_GIS = 'Prepaid Parcel on G.com Orders (PPPG)' AND mcd.contract_number LIKE '%NCP%' AND (Sum_Of_Sales_Current < 100000 OR Sum_Of_Sales_Current IS NULL  ) ) THEN '$100,000' 
		WHEN( MCD.Freight_GIS = 'Standard (PPA)' AND mcd.contract_number LIKE '%NCP%' AND (Sum_Of_Sales_Current < 50000 OR Sum_Of_Sales_Current IS NULL  ) )THEN '$50,000' ELSE '$50,000' END AS Expected_Volume  

Open in new window

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
FordraidersAuthor Commented:
THANKS
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
SQL

From novice to tech pro — start learning today.