Re: php-db Finding records with NULL values

From: Date: Tue, 26 Feb 2002 23:27:43 +0000
Subject: Re: php-db Finding records with NULL values
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-17318@lists.php.net to get a copy of this message
Pretty easy really SELECT * FROM foo WHERE bar is NULL - DON'T use quotes "NULL" is a valid string it is not the same as NULL - Some DBMS's allow you to say bar = NULL but technically this is wrong because NULL is undefined and cannot be equal to anything not even another NULL. - Also "" is not NULL - be sure you blank fields are NULL and not "" - A clever way to search for both "" and NULL in the same query is: SELECT * FROM foo WHERE NOT bar > "" This may not work in all DBMS's but give it a try; OR would work too. Good Luck, Frank On 2/26/02 2:20 PM, "php-db-digest-help@lists.php.net" <php-db-digest-help@lists.php.net> wrote: > From: "Robin McKenzie" <Robin.McKenzie.98@bris.ac.uk> > Date: Tue, 26 Feb 2002 21:49:00 -0000 > To: php-db@lists.php.net > Subject: Finding records with NULL values > > > > I have a table of questions, and a table of responses (initially empty) > which gets updated every time an answer is submitted, with the question > number, member id and response. > > I wish to produce a SELECT query that will find the questions that haven't > been answered by a particular member, i.e. a query that finds the questions > that DO NOT have an entry in responses. How can I do this? > > Regards, > > Robin > -- Frank Flynn Poet, Artist & Mystic

« previous php.db (#17318) next »