select
f.text,
sum(case when t.feedback_type = 'like' then 1 else 0 end) likes,
sum(case when t.feedback_type = 'dislike' then 1 else 0 end) dislikes
from feedbacks f
join (
select
l.feedback_id,
'like' feedback_type
from feedbacks_likes l
union all
select
d.feedback_id,
'dislike' feedback_type
from feedbacks_dislikes d
) t on (f.id = t.feedback_id)
group by f.text;