This question already has an answer here:
I am running a query in PHP and I am getting to many results. Here is the query:
mysql> SELECT `location` FROM `listings` WHERE `fulltext` LIKE '%a%' OR `title` LIKE
'%a%' AND location IN(33702,33709,33714,33716,33760,33762,33771,33773,33777,33781,33782)
ORDER BY `date` DESC \g
and this is the CMD result that I get, which matches exactly what I am getting in the PHP run:
+----------+
| location |
+----------+
| 78787 |
| 33782 |
| 33782 |
| 98102 |
| 33782 |
| 33782 |
| 33782 |
| 33782 |
| 33782 |
| 56564 |
| 44569 |
| 33782 |
| 33782 |
+----------+
13 rows in set (0.00 sec)
As you can see, I should not be getting 78787,98102,56564 or 44569. does anyone see what could be wrong with the query. Let me know if you need more info.
P.S. I originally had this set up to use RLIKE, and it will be again once I get this figured out.
</div>