hi all,
I dont use SQL that much as I have no real need but the little I do use it and I come across the following:
this may be obvious, I even know the problem however I would simply like the query to match either name OR lastname BUT NOT if username is admin or james
in my statement the NOT IN is ignored when lastname produces a match.
I beleive I have tried it the other way around with even more detrimental effects.
Any help appreciated, cheers
I dont use SQL that much as I have no real need but the little I do use it and I come across the following:
Code:
SELECT username,email FROM users WHERE username NOT IN('admin','james') AND name LIKE '%test%' OR lastname LIKE '%test%
this may be obvious, I even know the problem however I would simply like the query to match either name OR lastname BUT NOT if username is admin or james
in my statement the NOT IN is ignored when lastname produces a match.
I beleive I have tried it the other way around with even more detrimental effects.
Any help appreciated, cheers