Select records not equal to current date
Hi,
Not sure where this question fits, but it's fairly straightforward.
I have an ASP page with an SQL statement like so:
SELECT * FROM myTable WHERE status = 1 ORDER BY dateAdded
I have another field called expiryDate. I want to modify the SQL so that it does not return records which have passed their expiryDate.
However, most records will have a null value in their expiryDate field. If this is the case, I want them to be part of the recordset.
So I think I need something like this:
SELECT * FROM myTable WHERE status = 1 AND (expiryDate > GETDATE() OR expiryDate is null) ORDER BY dateAdded
Not sure what the syntax is.
thanks
s
|