954,585 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Query for Null Date

I have a Database that stores a residentID, apartment, MoveInDate, and MoveOutDate.
I am trying to run a query from this database to find the resident row where the MoveOutDate is NULL so I can enter the date they moved out. My Coldfusion is not the best and here is what I have been trying to do with no avail.

<cfquery datasource="residents" name="getrentals">
SELECT * 
FROM apartmentrentals 
WHERE ID = #URL.recordID# AND MoveOutDate = 'NULL"
</cfquery>


Can someone help me out with the correct syntax.

Thanks

mijorog
Newbie Poster
21 posts since Sep 2010
Reputation Points: 10
Solved Threads: 0
 

This has nothing to do with CF. It is a pure SQL question ;)

AND MoveOutDate = 'NULL'


NULL isn't a string. It is a special system value . You can't use equals "=" either. To find nulls you must use

WHERE  ColumnName IS NULL
arrgh
Posting Whiz
381 posts since Dec 2008
Reputation Points: 32
Solved Threads: 47
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: