I tried to get the customer that pay the maximum amount. It gave me the maximum amount but the wrong customer. what should i do?
SELECT temp.customerNumber, MAX
Using a join, possibly as follows:-
SELECT * FROM payments INNER JOIN ( SELECT MAX(amount) AS MaxAmount FROM payments ) Sub1 ON payments.amount = Sub1.MaxAmount
Down side of this is that if 2 people both have the same high payment then both will be returned.