|
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?
|