RE: [PHP-DB] finding records wiht non-null columns

From: Date: Thu, 03 Jan 2002 16:29:39 +0000
Subject: RE: [PHP-DB] finding records wiht non-null columns
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-15334@lists.php.net to get a copy of this message
Please note that "" (empty string) and NULL is not the same value. The following query will return records where x is not null: SELECT * FROM db WHERE x IS NOT NULL; But since "" and NULL is different values, it might just as well return empty strings. If you want records where x actually contains something, i.e. neither NULL og an empty string, the following should work fine: SELECT * FROM db WHERE x <> ""; Regards, -Bjarte- > -----Original Message----- > From: bill [mailto:bill@billtron.com] > Sent: Thursday, January 03, 2002 5:19 PM > To: php-db@lists.php.net > Subject: [PHP-DB] finding records wiht non-null columns > > > Is there a better query than > > SELECT * > FROM some_database > WHERE some_column <> "" > > I had tried > > WHERE some_column <> NULL but that didn't work.

« previous php.db (#15334) next »