troubleshooting Question

need a select case statement that will add 2 fields after evaluating a calculation, in the case statement.

Avatar of Fordraiders
FordraidersFlag for United States of America asked on
Microsoft SQL ServerSQL
11 Comments1 Solution184 ViewsLast Modified:
need a select case statement that will add 2 fields after evaluating a calculation

My data is here and i attached a workbook.

CASE STATEMENT EVALUATION
Column F (END DATE) HAS TO BE BEYOND todays date to evaluate.

For the "RANGE SCORE"  COMPARING   "G"  TO  "B" AND "C"
The criteria:



if the "sales sum" IS BELOW the "fromdollar" amount...The field gets populated with "BELOW RANGE"  
"Qualification Percent" gets populated with  0(zero)
if the "sales sum" IS ABOVE the "todollar" amount...The field gets populated with "ABOVE RANGE"      
"Qualification Percent" gets populated with  "BaseDiscountPercent" value
if the "sales sum" IS BETWEEN THE  "fromdollar" AND "TODOLLAR" amount...The field gets populated with "BETWEEN RANGE"  
"Qualification Percent" gets populated with  "BaseDiscountPercent" value

If the  "BaseDiscountPercent" value is null then the "Qualification Percent" gets populated with   "NONE STATED" value.

Here is my sql:

SELECT [contractNumber]
      ,[Fromdollar]
      ,[ToDollar]
      ,[BaseDiscountPercent]
      ,[StartDate]
      ,[EndDate]
     
     
  FROM [DATA].[dbo].[Tier_Discount]



Thanks
fordraiders
AA_RANGE_SQL.xlsx
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 11 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 11 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros