469,626 Members | 1,282 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,626 developers. It's quick & easy.

CASE and DATE statement - Need Help :)

1
Hi

Can someone help please.

I need to create a new column with a name of "AdvertPurchasePrice" based upon a Date Value which is held in a column called "AdvertCreationDate".

If the date is before the 10th of April 2007 then the column "AdvertPurchasePrice" needs to be 299 else it needs to be 399

Can anyone help???


Steve
Sep 6 '07 #1
1 1342
ck9663
2,878 Expert 2GB
Hi

Can someone help please.

I need to create a new column with a name of "AdvertPurchasePrice" based upon a Date Value which is held in a column called "AdvertCreationDate".

If the date is before the 10th of April 2007 then the column "AdvertPurchasePrice" needs to be 299 else it needs to be 399

Can anyone help???


Steve
use the CASE...WHEN...END statement...

select AdvertPurchasePrice = case when AdvertCreationDate is before 04/10/2007 then 299
else 399
end
from mytable

this is a pseudocode, not a working code...but if you search the help on the CASE-WHEN-END syntax, you'll see what i mean
Sep 6 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

3 posts views Thread by Dino | last post: by
9 posts views Thread by cousaert | last post: by
4 posts views Thread by Keon | last post: by
2 posts views Thread by Keith | last post: by
10 posts views Thread by Daniel | last post: by
1 post views Thread by microsoft.public.dotnet.languages.vb | last post: by
2 posts views Thread by =?Utf-8?B?QnJpYW4gQ29vaw==?= | last post: by
30 posts views Thread by fniles | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.