• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 158
  • Last Modified:

Sql syntax

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
red_75116
Asked:
red_75116
1 Solution
 
reb73Commented:
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
 
red_75116Author Commented:
thanks!  I discovered it already, but that is exactly what I entered.  Sorry about the zone
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Simplify Active Directory Administration

Administration of Active Directory does not have to be hard.  Too often what should be a simple task is made more difficult than it needs to be.The solution?  Hyena from SystemTools Software.  With ease-of-use as well as powerful importing and bulk updating capabilities.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now