Mysql not returning the correct resultset

Hi all i am new to the forums, nice to meet you looking forward to having a great time.
The following query is returning the correct results when written like

 select * from executive_case where currentassignie=1 and dateaudited is null or dateaudited = '0000-00-00'; 

And entirely different results when written like this

select * from executive_case where dateaudited is null or dateaudited = '0000-00-00' and currentassignie=1;

Is that a bug or is there a operator precedence in mysql.
Have a great day !

There certainly is precedence
https://dev.mysql.com/doc/refman/5.0/en/operator-precedence.html

I always take the lazy easy way out and use parentheses

great, everything is working now.
Thank you :smile:

[quote=“qwer, post:1, topic:193597, full:true”]Is that a bug or is there a operator precedence in mysql.
[/quote]
the latter

the same precedence as in all other database systems

:wink:

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.