Hi,
I have this table:
CREATE TABLE `test` (
`ID` int(11) NOT NULL auto_increment,
`text` varchar(250) collate utf8_unicode_ci default NULL,
PRIMARY KEY (`ID`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci
Content:
ID text 1 70-and-some-text 70 blub
Then I make execute this query:
SELECT
*
FROM
test
WHERE
ID = '70-and-some-text'
OR
text = '70-and-some-text'
and get both lines as a result. It seems that MySQL tries to match as many numbers against ID and then stops. I think I read that somewhere, but couldn't find it anymore.
Answer and hints are highly appreciated. Thanks in advance. And be kind, I'm new. Tell me, if I did something wrong. I have a lot of respect for you guys.
Steffen
==================
Thanks to Tomalak, I know now where the problem comes from. Any best practices for dealing with this? I control the 'text', so I could go for '_70-and-some-text' or the the string with PHP. But a solution in MySQL would be the "purest".