Not Returning Records with NULL value
Posted: Sun Aug 10, 2003 12:16 pm
The following code:
The records which are found are the records that have a value in laos.p_cell. I want to be able to return all records if that column has any values in it or not.
In other words, if laos.p_cell has a NULL value that record is skipped.
I don't want it skipped unless of course a value has been entered by the client through entering data in the search form.
Any suggestions?
-Dave
Code: Select all
SELECT laos.id, laos.oikos_id, laos.last, laos.first, laos.directory, laos.sex, laos.race, laos.status, laos.member, laos.p_cell, laos.s_cell, DATE_FORMAT(laos.birthday, '%c/%d/%Y') AS birthday, DATE_FORMAT(laos.aniversary, '%c/%d/%Y') AS aniversary, UNIX_TIMESTAMP(DATE_ADD(laos.datestamp, INTERVAL 3 hour)) AS datestamp
FROM laos
WHERE laos.last LIKE 'xLast%' AND laos.sex LIKE '%xSex%' AND laos.status LIKE '%xStatus%' AND laos.race LIKE '%xRace%' AND laos.p_cell LIKE 'xPG%'
ORDER BY laos.last ASC, laos.position, laos.birthdayIn other words, if laos.p_cell has a NULL value that record is skipped.
I don't want it skipped unless of course a value has been entered by the client through entering data in the search form.
Any suggestions?
-Dave