Apr 8, 2005 #1 B barski Well-known member Joined Apr 7, 2002 Messages 239 Location Tennessee 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 <?
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 <?
Apr 8, 2005 #2 M Mister E Well-known member Joined Jul 23, 2004 Messages 136 Code: SELECT *, ( CASE WHEN DAY([Date]) BETWEEN 1 AND 14 THEN [Sales]*2 ELSE [Sales] END ) As [SalesAdjusted] FROM [YourTable]
Code: SELECT *, ( CASE WHEN DAY([Date]) BETWEEN 1 AND 14 THEN [Sales]*2 ELSE [Sales] END ) As [SalesAdjusted] FROM [YourTable]
Apr 8, 2005 #3 B barski Well-known member Joined Apr 7, 2002 Messages 239 Location Tennessee thanks a bunch!! i kept using case field1 when < 1 .... or whatever the error in my logic or lack of is obvious
thanks a bunch!! i kept using case field1 when < 1 .... or whatever the error in my logic or lack of is obvious
Apr 8, 2005 #4 M Mister E Well-known member Joined Jul 23, 2004 Messages 136 I was just using "BETWEEN" to show whats going on. You could use an equality operator as well: Code: SELECT *, ( CASE WHEN DAY([Date]) < 15 THEN [Sales]*2 ELSE [Sales] END ) As [SalesAdjusted] FROM [YourTable]
I was just using "BETWEEN" to show whats going on. You could use an equality operator as well: Code: SELECT *, ( CASE WHEN DAY([Date]) < 15 THEN [Sales]*2 ELSE [Sales] END ) As [SalesAdjusted] FROM [YourTable]