Cito
Cito

Reputation: 1709

Really strange error on mysql query

I have this query, and I think it talks by itself:

mysql> select id,email from members where email LIKE "%[email protected]%";
+--------+----------------------------+
| id     | email                      |
+--------+----------------------------+
| 272118 | [email protected] | 
+--------+----------------------------+
1 row in set (0.69 sec)

mysql> select id,email from members where email = "[email protected]";
Empty set (0.00 sec)

mysql> select id,email from members where id = 272118;
Empty set (0.00 sec)

The data exists, but it returns empty if I use other than LIKE...

Upvotes: 1

Views: 71

Answers (2)

Denys Séguret
Denys Séguret

Reputation: 382464

When there is such a flagrant impossible sequence of queries, then it's time to think about a table (or index) corruption and to run the Mysql CHECK command.

In that case, running REPAIR TABLE members QUICK did the trick.

Upvotes: 3

Markus Mikkolainen
Markus Mikkolainen

Reputation: 3497

If the id is a varchar and the email is a varchar they might have surrounding spaces.

Upvotes: 0

Related Questions