-- Query which generated the table contact_temp used in the -- creation step of the simmctic database -- for details check simmctic/database/create/data/001-load_data_telecenter.sql -- and simmctic/database/create/data/contact_telecenter_temp.csv -- WARNING: Some telecenters were inserted without id_onid. Such telecenters -- cannot be identifyed unically (without id_point) and are removed of this -- query. COPY( SELECT t.id_onid , ct.name AS "responsible_name" , ct.rg AS "responsible_rg" , ct.cpf AS "responsible_cpf" , ct.post AS "responsible_post" , ct.phone1 AS "responsible_phone_1" , ct.phone2 AS "responsible_phone_2" , ct.phone3 AS "responsible_phone_3" FROM point p INNER JOIN telecenter t ON p.id = t.id_point INNER JOIN contact ct ON p.id = ct.id_point WHERE t.id_onid IS NOT NULL AND p.is_active ) TO STDOUT WITH CSV HEADER DELIMITER ';';