Show results if column = NULL

I'm trying to display results (for a property search in admin).

There's a 'live' column in the database which if  = 1 the property is live, if it's NULL is means the property is part-completed and not live.

I want to display the part-completed properties but can't get the query to work.

Here's what i'm trying:

SELECT properties.propertyID, properties.pricePrefix, images.selected, properties.memberID, properties.live, properties.country_code, images.filename, properties.name, FORMAT(properties.prices,0) as prices, properties.currency FROM properties INNER JOIN images ON properties.propertyID=images.propertyid WHERE   properties.memberID ='$userid' AND properties.live = 'NULL' ORDER by properties.prices ASC

Open in new window


This works fine to display the live properties with properties.live = '1' so the query is pretty close. I just can't get it to work with properties.live = 'NULL'

Any ideas?database
BrighteyesDesignAsked:
Who is Participating?
 
zappafan2k2Commented:
You have quotes around the word NULL, so MySQL is treating it like a string.

The proper syntax is
... where columnName is NULL ...

Open in new window

so you would want
... AND properties.live is NULL ...

Open in new window

0
 
BrighteyesDesignAuthor Commented:
Cheers!
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.

All Courses

From novice to tech pro — start learning today.