This query returns rows with latitude = 0
and longitude = 0
SELECT `id`,
`first_name`,
`last_name`,
`address`,
`latitude`,
`longitude`
FROM `members`
WHERE (`temp` != 'on' OR `temp` IS NULL)
AND (`backup` != 'on' OR `backup` IS NULL)
AND (`latitude` IS NOT NULL OR `latitude` != 0 OR `latitude` != '')
AND (`longitude` != 0 OR `longitude` != '' OR `longitude` IS NOT NULL)
AND `address` != ''
AND `type_id` = 1
AND `first_name` != ''
query is returning rows where lat/long have 0 value - Datatype = VARCHAR
You want and
, not or
:
WHERE (`temp` != 'on' OR `temp` IS NULL)
AND (`backup` != 'on' OR `backup` IS NULL)
AND (`latitude` IS NOT NULL and `latitude` != 0 and `latitude` != '')
AND (`longitude` != 0 and `longitude` != ''and `longitude` IS NOT NULL)
AND `address` != ''
AND `type_id` = 1
AND `first_name` != ''
Latitude
may be 0 (failing that condition), but it is not NULL
-- passing that one.
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments