--- a/exportData.csv.php +++ b/exportData.csv.php @@ -6,7 +6,9 @@ $result = mysql_query(' SELECT CNID,contractnotice.agencyName,agency.abn as agencyABN,DATE(publishDate),contractStart,contractEnd,value,description,procurementMethod,category,categoryUNSPSC ,supplierABN,supplierName,supplierCity,supplierPostcode,supplierCountry,contactPostcode, -IF(supplierABN != "",supplierABN,supplierName) as supplierID, +( + case when "supplierABN" != 0 THEN "supplierABN"::text ELSE "supplierName" END) as supplierID + concat("https://www.tenders.gov.au/?event=public.advancedsearch.keyword&keyword=CN",CNID) as sourceURL FROM `contractnotice` join agency on contractnotice.agencyName=agency.agencyName where childCN = 0'); if (!$result) die('Couldn\'t fetch records');