--- a/displayConsultancies.php +++ b/displayConsultancies.php @@ -10,20 +10,23 @@ */ include_header("Consultancies"); -$query = "SELECT value, procurementMethod -FROM `contractnotice` -GROUP BY procurementMethod "; +$query = ' +SELECT SUM(value) as value, count(*), min("supplierName"), unnest(string_to_array("consultancyReason",\';\')) reason +FROM contractnotice where ' .$yearQ . ' "consultancy" = \'Yes\' and "childCN" is null +GROUP BY "supplierABN",reason order by value desc + '; -$result = mysql_query($query); + $query = $conn->prepare($query); + $query->execute(); + databaseError($conn->errorInfo()); echo "
{$row[1]} | \$$value | ||
{$row[2]} | {$row[3]} | {$row[1]} contracts | \$$value |