Page 1 of 1
What are the operator precedences in this?
Posted: Wed Jul 02, 2003 11:45 am
by jkj2001
Someone ran a search like so, with no parentheses. I'm trying to understand just what was run:
select * from mytable where myfield like '"SC"' OR myfield like '"South Carolina"' AND myfield like 'newell' OR myfield like 'stanton' OR myfield like 'schiff'
I'm not 100% sure how the AND in the middle there is playing out. Thanks for helping clear my head on this.
What are the operator precedences in this?
Posted: Wed Jul 02, 2003 12:52 pm
by John
The AND has a higher precedence, so it is like:
select * from mytable where
myfield like '"SC"' OR
(myfield like '"South Carolina"' AND myfield like 'newell') OR
myfield like 'stanton' OR
myfield like 'schiff'
What are the operator precedences in this?
Posted: Wed Jul 02, 2003 1:48 pm
by jkj2001
Thanks, John.
Before I go, any chance I can slip one more question your way?
I've got this search:
select * from mytable where (myfield like 'binder "file folder" "fax cover" @0')
It returns appropriate hits mixed in with things like "Binder Tab File Folder", which I thought was a little strange, since I put "file folder" in quotes.
Does this happen because @0 doesn't run post-processing and therefore sort of ignores the quotes, at least in the prefix? Is it possible to run the @0 search with an exact match for "file folder"?
What are the operator precedences in this?
Posted: Wed Jul 02, 2003 2:44 pm
by John
Maybe I'm missing something, but that looks like an appropriate hit, as both binder and "file folder" are in there, and only one would be required for a match.