--- a/sitemap.xml.php +++ b/sitemap.xml.php @@ -43,7 +43,8 @@ } } if ($_REQUEST['section'] == "supplier") { - $result = $conn->query('SELECT DISTINCT "supplierABN", "supplierName" from contractnotice'); + $result = $conn->query('SELECT DISTINCT on ("supplierID") ( + case when "supplierABN" != 0 THEN "supplierABN"::text ELSE "supplierName" END) as "supplierID", "supplierABN", "supplierName" from contractnotice'); foreach ($result->fetchAll() as $row) {