Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Sql syntax

Posted on 2009-02-11
2
Medium Priority
?
157 Views
Last Modified: 2012-05-06
I need to modify a sql query and I need some help.  Here is the original case statement that works.

case
when (biddate > saledate) or saledate is null then biddate
when biddate <= saledate then saledate
else 0
end as anchordt,

However, I need to add this if/then clause or something.  When bidstatus='Y' then I the anchotdt to be getdate().  I cannot get it working.  I always get null values.  Biddate should be null when Bidstatus is "y" and I don't know if that is messing it up or not.
0
Comment
Question by:red_75116
2 Comments
 
LVL 25

Accepted Solution

by:
reb73 earned 2000 total points
ID: 23616869
Like this?

case
when bidstatus = 'Y' or biddate is null then getdate()
when (biddate > saledate) or saledate is null then biddate
when biddate <= saledate then saledate
else 0
end as anchordt,

By the way this question is incorrectly posted in the wrong zone..
0
 

Author Closing Comment

by:red_75116
ID: 31545768
thanks!  I discovered it already, but that is exactly what I entered.  Sorry about the zone
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

There can be many situations demanding the conversion of Outlook OST files to PST format and as such, there is no shortage of automated tools to perform this conversion. However, what makes Stellar OST to PST converter stand above the rest? Let us e…
You finally migrated Public Folders to Office 365, decommissioned the Public Folder mailbox database and since then, when you send an email from on-premise to mail-enabled Public Folders, you get the following error: "Misconfigured public folder mai…
The video tutorial explains the basics of the Exchange server Database Availability groups. The components of this video include: 1. Automatic Failover 2. Failover Clustering 3. Active Manager
This video discusses moving either the default database or any database to a new volume.
Suggested Courses

564 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question