Bug #45837 | Logical AND not giving expected results as explained in Manual | ||
---|---|---|---|
Submitted: | 29 Jun 2009 18:53 | Modified: | 30 Jun 2009 3:50 |
Reporter: | Bob Hansen | Email Updates: | |
Status: | Not a Bug | Impact on me: | |
Category: | MySQL Server: Documentation | Severity: | S2 (Serious) |
Version: | 5.1.35 community | OS: | Windows (XP Pro SP2) |
Assigned to: | CPU Architecture: | Any | |
Tags: | and, boolean, conflicts, documentation, Logic, Logical, match, not, results, wrong |
[29 Jun 2009 18:53]
Bob Hansen
[29 Jun 2009 18:54]
Bob Hansen
Documentation for Logical Operators: http://dev.mysql.com/doc/refman/5.1/en/logical-operators.html
[30 Jun 2009 3:50]
Valeriy Kravchuk
Sorry, but this is not a bug. That manual page you mentioned clearly says: "Note that MySQL evaluates any nonzero or non-NULL value to TRUE." So, 1, 2, 3 ... 8 all are interpreted as TRUE, same as 4. TRUE AND TRUE correctly gives TRUE. What you expected from && is bitwise AND. This is done with another operator, &, as you also noted. Read http://dev.mysql.com/doc/refman/5.1/en/bit-functions.html for the details.