barski Posted April 8, 2005 Posted April 8, 2005 if have something like date sales 3/1/2004 1000 3/31/2004 2000 if the date is less than 3/15/2004 then multiply sales by 2 using a case i can handle true/false expressions but how do i handle > and <? Quote
Mister E Posted April 9, 2005 Posted April 9, 2005 SELECT *, ( CASE WHEN DAY([Date]) BETWEEN 1 AND 14 THEN [sales]*2 ELSE [sales] END ) As [salesAdjusted] FROM [YourTable] Quote
barski Posted April 9, 2005 Author Posted April 9, 2005 thanks a bunch!! i kept using case field1 when < 1 .... or whatever the error in my logic or lack of is obvious Quote
Mister E Posted April 9, 2005 Posted April 9, 2005 I was just using "BETWEEN" to show what's going on. You could use an equality operator as well:SELECT *, ( CASE WHEN DAY([Date]) < 15 THEN [sales]*2 ELSE [sales] END ) As [salesAdjusted] FROM [YourTable] Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.