I'm looking for solution for the following issue:
SELECT CASE WHEN p.value LIKE '%foo%' THEN 'foos'
    WHEN p.value LIKE '%bar%' THEN 'bars'
    WHEN p.value LIKE '%bakar%' THEN 'bakars'
    ELSE p.value END as value,
COUNT(*) as count FROM table_a p GROUP BY value
Values are something like:
foo, bar, foo and bar, bakar, bakarbar, foobar
Result of this query is:
 value    count
 foos       3
 bars       2
 bakars     1
This code successfully counts occurrences, but the CASE stops at first match. Is there a way to do this?
value    count
 foos       3
 bars       4
 bakars     2
 
     
     
     
     
    