Mysql SELECT WHERE LIKE
I want to use AND and OR to select some stuff that I need from a table. I've done this:
mysql> SELECT * FROM msgs WHERE nick LIKE 'ivanatora' OR nick LIKE 'anga%'; <= works fine mysql> SELECT * FROM msgs WHERE nick LIKE 'ivanatora' AND msg LIKE 'test%'; <= too mysql> SELECT * FROM msgs WHERE nick LIKE 'ivanatora' OR nick LIKE 'anga%' AND msg LIKE 'test%'; <= this one shows all where nick is like 'ivanatora' But I want to combine some more ANDs and ORs to make my selection more exact. My question is: how all these combinations prioritized? Does the ANDs are compared before ORs or vice versa? |
You just have to use brackets... it's like math :-)
(x || y) && z x || (y && z) You know what I mean? Greetings, Sascha |
Thanks, it worked :)
|
Glad I could help you :-)
|
All times are GMT -5. The time now is 08:28 PM. |