Не могу запустить sql запрос, выходит ошибка [22P02] ОШИБКА: неверное значение для целого числа: "119-1"
Это мой код
select * from crosstab($$
**select code_r, code_o,case when tab3.count is null then 0 else tab3.count::bigint end from (
select r.code as code_r,o.id as organ_id_o,o.code as code_o from ref_crime_code r**
inner join ref_location_organ o on 1=1
where r.level =0 and r.type_id in (970) order by code_o,code_r ) as tab1
left join (
select code_s,organ_id, count(*) from (
select distinct on (aud.id)
case when c.level = 0 then c.code when c1.level = 0 then c1.code else c2.code end as code_s,
organ_id
from erpp_aud aud
inner join m2m_erpp_ref_crime_code mc on mc.erpp_id = aud.id
inner join ref_crime_code c on c.id = mc.ref_crime_code_id and c.type_id in (970)
left join ref_crime_code c1 on c1.id = c.parent_id
left join ref_crime_code c2 on c2.id = c1.parent_id
where movement_point_id <> 399 and uid_suffix is null and movement_reason_id = 2010
order by aud.id,rev desc, c.id
) as tab2 group by code_s,organ_id
) tab3 on tab1.code_r = tab3.code_s and tab1.organ_id_o = tab3.organ_id order by code_r::int,2
$$)
[22P02] ОШИБКА: неверное значение для целого числа: "119-1" Где: SQL-оператор: " select code_r, code_o,case when tab3.count is null then 0 else tab3.count::bigint end from ( select r.code as code_r,o.id as organ_id_o,o.code as code_o from ref_crime_code ...