Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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 <?

Posted
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]

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...