From 081ce76085f527ee429f78167f5c981ffeca1e15 Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Fri, 10 Mar 2023 16:16:27 +0100 Subject: [PATCH] renaming alias --- sql/import.sql | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/sql/import.sql b/sql/import.sql index 6615ba5..308dce7 100644 --- a/sql/import.sql +++ b/sql/import.sql @@ -236,11 +236,6 @@ DO $$ --SELECT mobilenumber, mobilenumber1, phonenumber, phonenumber1 FROM import.personnes ORDER BY id; END $$; --- 35. Prepare required default dates --- address_validfrom1 | household_startdate1 --- acp_openingdate1 - - -- 40. Prepare id mapping before insertion ALTER TABLE import.personnes ADD column person_id BIGINT; UPDATE import.personnes SET person_id=personid @@ -290,11 +285,11 @@ INSERT INTO chill_person_person_center_history (id, person_id, center_id, startd ALTER TABLE import.personnes ADD column address_id BIGINT; UPDATE import.personnes SET address_id = nextval('chill_main_address_id_seq'); ALTER TABLE import.personnes ADD column postcode_id BIGINT; -UPDATE import.personnes SET postcode_id = cmpc.id FROM chill_main_postal_code cmpc WHERE cmpc.code = postcode AND cmpc.origin = 0; +UPDATE import.personnes SET postcode_id = pc.id FROM chill_main_postal_code pc WHERE pc.code = postcode AND pc.origin = 0; INSERT INTO chill_main_address (id, postcode_id, street, streetnumber, extra, validFrom) SELECT address_id, postcode_id, street, streetnumber, extra, COALESCE(validfrom1 , date(date_trunc('year', CURRENT_DATE))) FROM import.personnes WHERE postcode_id IS NOT NULL; -SELECT ip.person_id, ip.address_id FROM import.personnes ip ; +-- SELECT ip.person_id, ip.address_id FROM import.personnes ip ; -- SELECT ip.id, ip.person_id, ip.firstname, ip.lastname, addr.* FROM chill_main_address addr RIGHT JOIN import.personnes ip ON addr.id = ip.address_id ORDER BY ip.id; -- 44. Add houshold and household member with position