I have two tables, customers
and payments
, I want to check for each client which was the highest and lowest payment that each one made.
I did this SQL, but it did not work, could anyone help me?
SELECT c.customerName, max(p.amount), min(p.amount)
FROM customers c, payments p
WHERE p.customerNumber = c.customerNumber
ORDER BY c.customerNumber