如图,字段tid保存的是文章标签id,用逗号分隔的字符串,我现在想通过标签,来查出来所有的文章,比如“2”,来查出所有tid字段里有2的文章,现在我用SELECT * FROM `t_ms_article` WHERE `tid` IN (2)语句只能查出来以2开头的文章,而不能查出来‘1,2,3’这样的
希望能帮我一下,我是菜鸟
SELECT * FROM `t_ms_article` WHERE `tid` LIKE ‘%2%’;
SELECT * FROM `t_ms_article` WHERE `tid` LIKE ‘%2%’;
SELECT * FROM `t_ms_article` WHERE find_in_set('2', `tid`)
SELECT * FROM `t_ms_article` WHERE CONCAT(',',`tid`,',') LIKE ‘%,2,%’;
SELECT * FROM `t_ms_article` WHERE find_in_set('2', `tid`)