У меня есть таблица, подобная приведенной ниже1010 * Ожидаемый результат
one two thr 3 2 2
вы можете использовать условное агрегирование с case when expression -
case when expression
select count(case when val=1 then name end) as one, count(case when val=2 then name end) as two, count(case when val=3 then name end) as thr from tbl_test