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

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
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.