iceblox Posted October 28, 2007 Share Posted October 28, 2007 Hi Guys, I have a database of mobile phone deals and i want to be able to return deals that have a gift assigned to them. There are many that dont so i was thinking a query like this would work but it doesnt. Am I being Blonde? $query = "SELECT * FROM deals WHERE FreeGift IS NOT NULL "; Link to comment https://forums.phpfreaks.com/topic/75131-how-to-return-not-null-fields/ Share on other sites More sharing options...
sasa Posted October 28, 2007 Share Posted October 28, 2007 WHERE !isnull(FreeGift) Link to comment https://forums.phpfreaks.com/topic/75131-how-to-return-not-null-fields/#findComment-379972 Share on other sites More sharing options...
iceblox Posted October 28, 2007 Author Share Posted October 28, 2007 Hmm that doesnt seem to have worked Link to comment https://forums.phpfreaks.com/topic/75131-how-to-return-not-null-fields/#findComment-379978 Share on other sites More sharing options...
toplay Posted October 28, 2007 Share Posted October 28, 2007 Then their values are probably not null and simply an empty string. You should post the column definition of "FreeGift". If it's simply and empty string, then you can use...WHERE FreeGift != ''; Post moved to MySQL help section Link to comment https://forums.phpfreaks.com/topic/75131-how-to-return-not-null-fields/#findComment-379981 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.