I wanna get the data set where either latitude is between x and y value OR where adress is equal to xyz. But this fails:
... Running query: SELECT title,description,adress,likesAmount,price,hasVideo,thumbnail,colorId, colorId2, colorId3,conditionId,materialId, materialId2, materialId3 ,verified,classic,subcategoryId,categoryId,dateUpdatedInt,brandId,userId,tblAddID,timeCreated,timeUpdated,isSold, soldToUserID FROM 10299_12188_tblAdds Where soldToUserID=0 AND (price >= null AND price <= null) AND (latitude >= 0 AND latitude <= 0) OR (adress = null) AND (longitude >= 0 AND longitude <= 0) OR (adress = null) AND (dateUpdatedInt >= null) AND (classic = null) AND (conditionId = null) AND (verified = null) AND (categoryId = null) AND (subcategoryId = null OR subcategoryId = null OR subcategoryId = null) AND (materialId = null OR materialId2 = null OR materialId3 = null OR materialId = null OR materialId2 = null OR materialId3 = null OR materialId = null OR materialId2 = null OR materialId3 = null) AND (brandId = null OR brandId = null OR brandId = null) ORDER BY price ASC LIMIT null, null
Where is my mistake?
Thank you!
Advertisement
Answer
you need to change this part and since now you updated your full query , maybe with other parts as well:
AND ( latitude >= 0 AND latitude <= 0 ) OR (adress = null) AND ( longitude >= 0 AND longitude <= 0 ) OR (adress = null)
to this :
AND ( ((latitude >= 0 AND latitude <= 0) AND (longitude >= 0 AND longitude <= 0)) OR (adress is null) )