RE: [PHP-DB] finding records wiht non-null columns
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:[EMAIL PROTECTED]] > Sent: Thursday, January 03, 2002 5:19 PM > To: [EMAIL PROTECTED] > 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. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP-DB] finding records wiht non-null columns
In my database (Sybase) that won't work. You have to use not like 'NULL' or it gives an error about not using text in a where clause unless you use like. Weird, but it will work with the not like 'NULL'. -Natalie > -Original Message- > From: Jonathan Hilgeman [SMTP:[EMAIL PROTECTED]] > Sent: Thursday, January 03, 2002 11:21 AM > To: 'bill' > Cc: '[EMAIL PROTECTED]' > Subject: RE: [PHP-DB] finding records wiht non-null columns > > ...WHERE some_column IS NOT NULL; > > - Jonathan > > -Original Message- > From: bill [mailto:[EMAIL PROTECTED]] > Sent: Thursday, January 03, 2002 8:19 AM > To: [EMAIL PROTECTED] > 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. > > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP-DB] finding records wiht non-null columns
...WHERE some_column IS NOT NULL; - Jonathan -Original Message- From: bill [mailto:[EMAIL PROTECTED]] Sent: Thursday, January 03, 2002 8:19 AM To: [EMAIL PROTECTED] 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. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]