Jump to content

select all that are a NULL


poe

Recommended Posts

how do i select items from a database that are a NULL

 

i have:

$qxs = " SELECT l.ID, l.TITLE, l.FEATURED, l.LINK_TYPE, l.EXPIRY_DATE, p.LINK_ID, p.QUANTITY, p.PAY_DATE ";
$qxs .= " FROM `tbl_link` = l, `tbl_payment` = p ";
$qxs .= " WHERE p.LINK_ID = l.ID ";
$qxs .= " AND l.EXPIRY_DATE = NULL ";
$result = mysql_query( $qxs );

 

but shows 0 results...

 

if i drop the " AND l.EXPIRY_DATE = NULL ";

 

this gives me results.

Link to comment
https://forums.phpfreaks.com/topic/57030-select-all-that-are-a-null/
Share on other sites

It's the =NULL.  It should be "IS NULL".

 

...AND l.EXPIRY_DATE IS NULL

 

I'm surprised, but the "tbl_link = l" does work.  You don't need the "=", but bg.anarchy is right that it's usually "AS".  Anyway, you can alias without either.

 

...FROM tbl_link l, tbl_payment p...

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.