SELECT category cat1,
COUNT(CASE WHEN TYPE = 'P' THEN 1 END) type_p,
COUNT(CASE WHEN TYPE = 'T' THEN 1 END) type_t
GROUP BY category, cat
ORDER BY cat1, cat2 DESC;
This works perfect for the answer work in that topic, what about if i want to create a column to count the respective fields that contain any of these words: rec, ric or roc. This is similar to the count(case... but i want to do something similar with a like for any of these three words, any idea?