poe Posted June 25, 2007 Share Posted June 25, 2007 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 More sharing options...
bubblegum.anarchy Posted June 25, 2007 Share Posted June 25, 2007 The problem is: FROM `tbl_link` = l, `tbl_payment` = p should be: FROM `tbl_link` AS l, `tbl_payment` AS p Link to comment https://forums.phpfreaks.com/topic/57030-select-all-that-are-a-null/#findComment-281736 Share on other sites More sharing options...
Wildbug Posted June 25, 2007 Share Posted June 25, 2007 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... Link to comment https://forums.phpfreaks.com/topic/57030-select-all-that-are-a-null/#findComment-282080 Share on other sites More sharing options...
bubblegum.anarchy Posted June 26, 2007 Share Posted June 26, 2007 yeah, that to. Link to comment https://forums.phpfreaks.com/topic/57030-select-all-that-are-a-null/#findComment-282620 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.