![]() |
SQL code...if NOT....
Ok, is there any way to make this query better? It seems like I should be able to somehow use less "AND"...
Code:
SELECT * FROM users WHERE user_id != '5' AND user_id != '6' AND user_id != '9' AND user_id != '3'; |
First, why are you wrapping integers in quotes? Second, and more to the point, to use less (no!)
ANDs you could use …WHERE user_id NOT IN (5, 6, 9, 3) |
Quote:
Yes I suppose using quotes turns the numbers into strings right? Or is that just a PHP thing? |
Yes, it's just more work for the MySQL engine to do as I assume your user_id values are integers.
|
Quote:
I will have to keep this in mind... ^^ |
| All times are GMT. The time now is 01:23 PM. |
Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0