всем привет. есть кто юзает Knex? как средствами knex переписать можно вот sql:
with recursive q as ( select id, type, parentid,type_structure, type as subordination from structure.type_post where id in (select id from structure.type_post)),
new_table as (select
c.id, c.type,c.parentid, c.type_structure, q.subordination as subordination from structure.type_post c inner join q on c.parentid=
q.id)
select
officials.id, status, fullname,type,address,telefon,shedule,link_name,email,subordination,type_structure.type_name from new_table
left join structure.type_structure ON new_table.type_structure=type_structure.id
left join structure.officials ON new_table.id=officials.type_post where type_structure.id=2 order by type_structure.id asc, new_table.id asc