Your select would look like this:
SELECT COUNT(v.id) as qtd_vendas, v.client_id as id_cliente, c.nome as cliente
FROM tb_vendas v
LEFT JOIN tb_cliente c ON c.id = v.client_id
GROUP BY id_cliente, cliente
ORDER BY qtd_vendas DESC;
From the moment you rename a column with the AS you can put in the GROUP BY and ORDER BY only the last names.
I put this other adding the value of sales per customer also (taking into account that for each sale we have the value of the same) and ordering the maximum value of the sale, which is so:
SELECT COUNT(v.id) AS qtd_vendas,
SUM(v.valor_venda) AS valor_venda,
v.client_id as id_cliente, c.nome as cliente
FROM tb_vendas v
LEFT JOIN tb_cliente c ON c.id = v.client_id
GROUP BY id_cliente, cliente
ORDER BY qtd_vendas DESC;
Explaining this last select:
- COUNT will count the amount of sales made per customer;
- SUM is to sum up the value of sales and present per customer.
- LEFT JOIN because you want to stress the amount of sales per customer or be the priority is customers but who are on the sales chart.
- GROUP BY group the information by client and how I put the client name, also need to inform this field in group by.
- ORDER BY paid value DESC, orders the result at the maximum amount of purchases made for the lowest amount of purchases made per customer, already showing you which customer bought the most (remembering that here would have the value of which customer bought more times, if you want the customer who had the highest value in real purchases just exchange to sort by the field value_sale).