Jump to content

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...

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.