I have two tables, clients and transactions, I´m trying to show on the same row the SUM and COUNT of all the transactions from the same client, and type of transactions, but I don't know how to group it so it only shows the totals of one client and on the next row the total for another client withouth repeting it. Thank you for your time.
table clients
id_client - client_name
table transacctions
id_transaction - client_id - date - type - amount
$query = " SELECT * FROM transacctions, clients
WHERE (transacctions.date BETWEEN '$date1' AND '$date2')
AND transactions.client_id = clients.id_client
AND transactions.type = '$type' ; "
<th>Client Name</th>
<th>Transaction Type</th>
<th>Number of Transactions</th>
<th>total amount</th>
$output.='<td>'.$row['client_name'].'</td>';
$output.='<td>'.$row['type'].'</td>';
$output.='<td>'.$row['SUM(amount)'].'</td>';
$output.='<td>'.$row['COUNT(amount)'].'</td>';