Migrate agencies to 2 tables
Migrate agencies to 2 tables

--- a/exportData.csv.php
+++ b/exportData.csv.php
@@ -12,14 +12,14 @@
 }
 
 $query = $conn->prepare('
-SELECT "CNID",contractnotice."agencyName",agency.abn as "agencyABN",
+SELECT "CNID",contractnotice."agencyName",agency_nametoabn.abn as "agencyABN",
 EXTRACT(EPOCH FROM "publishDate") as "publishDate",
 EXTRACT(EPOCH FROM "contractStart") as "contractStart",
 EXTRACT(EPOCH FROM "contractEnd") as "contractEnd",
 value,description,category,
 "supplierName",(case when "supplierABN" != 0 THEN "supplierABN"::text ELSE "supplierName" END) as supplierID,
 (\'https://www.tenders.gov.au/?event=public.advancedsearch.keyword&keyword=CN\'::text || "CNID"::text) as sourceURL 
-FROM contractnotice join agency on contractnotice."agencyName"=agency."agencyName"  
+FROM contractnotice join agency_nametoabn on contractnotice."agencyName"=agency_nametoabn."agencyName"  
 where "childCN" is null'
         , array(PDO::ATTR_CURSOR => PDO::FETCH_ORI_NEXT));
 $query->execute();