MySQL Forums
Forum List  »  Newbie

BINARY operator not working properly
Posted by: Marco Nogueira
Date: July 04, 2013 07:23AM

I have this query:
SELECT 1 AS one FROM `products` WHERE `products`.`price` = BINARY 1.1 LIMIT 1;

That doesn't return the one row it should, but it works fine if I change it to :

SELECT 1 AS one FROM `products` WHERE BINARY `products`.`price` = 1.1 LIMIT 1;

Now I wonder, why?
From the docs (http://dev.mysql.com/doc/refman/5.1/en/charset-binary-op.html), we should prefer using the BINARY before the value (first statement), so it can use the index, and I assumed that this was a "good practice".

Can someone, please, point me towards the solution? Is this a bug?
(Ver 14.14 Distrib 5.1.54 by the way)

Options: ReplyQuote


Subject
Written By
Posted
BINARY operator not working properly
July 04, 2013 07:23AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.