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
ASKER CERTIFIED SOLUTION
D B
Software Developer

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Log in to continue reading
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform for $9.99/mo
View membership options
Unlock 1 Answer and 11 Comments.
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
See how we're fighting big data
The Value of Experts Exchange in My Daily IT Life

Experts Exchange (EE) has become my company's go-to resource to get answers. I've used EE to make decisions, solve problems and even save customers. OutagesIO has been a challenging project and... Keep reading >>

Mike

Owner of Outages.IO
Phoenix, Arizona, United States
Member Since 2016
Join a full scale community that combines the best parts of other tools into one platform.
Unlock 1 Answer and 11 Comments.
View membership options
“All of life is about relationships, and EE has made a virtual community a real community. It lifts everyone's boat.”
William Peck

Member since 2004