|
|
src: |
|
|
|
( SELECT DISTINCT t_poles_oap.oid,
|
|
|
(t_poles_oap.code::text || ' '::text) || t_poles_oap.texte::text AS texte,
|
|
|
'1'::text AS level,
|
|
|
t_poles_oap.code,
|
|
|
'pole'::text AS level_name
|
|
|
FROM pmsi.t_poles_oap,
|
|
|
pmsi.t_lignes_oap,
|
|
|
pmsi.t_ghm
|
|
|
WHERE t_ghm.ligne_oap_id = t_lignes_oap.oid AND t_lignes_oap.pole_oap_id = t_poles_oap.oid AND (t_ghm.oid IN ( SELECT DISTINCT p_rss.ghm_id
|
|
|
FROM pmsi.p_rss
|
|
|
ORDER BY p_rss.ghm_id))
|
|
|
ORDER BY t_poles_oap.oid, ((t_poles_oap.code::text || ' '::text) || t_poles_oap.texte::text), '1'::text, t_poles_oap.code, 'pole'::text)
|
|
|
UNION
|
|
|
( SELECT DISTINCT t_lignes_oap.oid,
|
|
|
(t_lignes_oap.code::text || ' '::text) || t_lignes_oap.texte::text AS texte,
|
|
|
'2'::text AS level,
|
|
|
t_lignes_oap.code,
|
|
|
'ligne'::text AS level_name
|
|
|
FROM pmsi.t_lignes_oap,
|
|
|
pmsi.t_ghm
|
|
|
WHERE t_ghm.ligne_oap_id = t_lignes_oap.oid AND (t_ghm.oid IN ( SELECT DISTINCT p_rss.ghm_id
|
|
|
FROM pmsi.p_rss
|
|
|
ORDER BY p_rss.ghm_id))
|
|
|
ORDER BY t_lignes_oap.oid, ((t_lignes_oap.code::text || ' '::text) || t_lignes_oap.texte::text), '2'::text, t_lignes_oap.code, 'ligne'::text)
|
|
|
ORDER BY 4;
|