Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
Thread: LIKE not working as excepted?
05-06-2014, 11:08 AM #1
- Join Date
- Feb 2014
- Thanked 0 Times in 0 Posts
LIKE not working as excepted?
My LIKE in sql queries isn't working as I excepted, I'm not good with sql so any help would be great!
I run this query
SELECT * FROM people WHERE readers > '0' AND subscribers > '0' AND minValue < '5' AND about LIKE '%40%' AND country=1 OR country=2
It must only return where people in the about field has the value 40 somewhere. The problem is it returns all of them as if the LIKE caluse isn't present?
I'm not sure why when I just run
SELECT * FROM people WHERE about LIKE '%40%'
It does only return the ones it should
05-06-2014, 05:30 PM #2
- Join Date
- Jan 2011
- Thanked 695 Times in 693 Posts
If I get what your looking for [no parentheses makes it vague)
SELECT * FROM people WHERE readers > '0' AND subscribers > '0' AND minValue < '5' AND about LIKE '%40%' AND (country=1 OR country=2)
Evolution - The non-random survival of random variants.
"If you leave hydrogen alone, for long enough, it begins to think about itself."