Reputation: 1108
When running the following query:
SELECT id,name,verified FROM servers WHERE verified=1 AND enabled=1 AND suspended=0 AND name LIKE '%.net%' || ip LIKE '%.net%' ORDER BY score DESC
MySQL is returning incorrect results. Here is the result of that input:
+----+-------------------+----------+
| ID | name | verified |
+----+-------------------+----------+
| 34 | BlockedUp | 1 |
| 8 | aliacraft | 1 |
| 27 | Limitless MC | 1 |
| 31 | OPCraft | 1 |
| 33 | LoneWolves Prison | 1 |
| 47 | purpleprison.net | 0 |
+----+-------------------+----------+
What could be the reason for this? The last row does obviously not match the requirement of verified=1.
Upvotes: 0
Views: 44
Reputation: 44844
You need to move
AND name LIKE '%.net%' || ip LIKE '%.net%'
in braces as
AND ( name LIKE '%.net%' or ip LIKE '%.net%' )
Upvotes: 4