select id,vacancy_id,prof_area_ids,latitude,longitude from jobVacancy
where prof_area_ids=199 group by vacancy_id;
SELECT GROUPBY() AS prof_area_id, COUNT(DISTINCT vacancy_id) FROM jobVacancy
WHERE prof_area_ids=199 GROUP BY prof_area_id;
select t.id, t.b1_name, b2.b2_name
from (
select p.id, b1.b1_name, row_number() over (partition by p.id order by b1_name) as rn
from parent p
join branch_1 b1 on b1.parent_id = p.id
) t
left join (
select parent_id, b2_name,
row_number() over (partition by parent_id) as rn
from branch_2
) b2 on b2.parent_id = t.id and b2.rn = t.rn
order by t.id;