Can someone explain to me why with this request:
SELECT * FROM `tags` WHERE (tag IN ('willa-lentza', 2016))
it returns me all the rows from the table tags, but when I put 2016in quotation marks does it work well?
Columntaghas type varchar.
SAMPLE ENVIRONMENT
CREATE TABLE `tags` (
`id` int(10) unsigned NOT NULL auto_increment,
`tag` varchar(255) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=6 DEFAULT CHARSET=utf8
INSERT INTO `tags` (`id`, `tag`) VALUES
(1, '2016'),
(2, 'plum'),
(3, 'banana'),
(4, 'apple'),
(5, 'willa-lentza');
I also get the same error as Roland Buman:
Truncated incorrect DOUBLE value: 'willa-lentza'
source
share