mysql select count if contains

Solutions on MaxInterview for mysql select count if contains by the best coders in the world

showing results for - "mysql select count if contains"
Gianluca
28 Aug 2019
1SELECT sum( case when `tags_Column` CONTAINS 'tag2' then 1 else 0 end ) as tag2,
2       sum( case when `tags_Column` CONTAINS 'tag3' then 1 else 0 end ) as tag3,
3       .....
4       sum( case when `tags_Column` CONTAINS 'tag256' then 1 else 0 end ) as tag256,
5       sum( case when `tags_Column` CONTAINS `tag2` OR 
6                      `tags_Column` CONTAINS 'tag3`
7            then 0 else 1 end ) as doesnt_contains_tags_2_3
8FROM `TableContainsTags`