jeudi 22 octobre 2015

Show multiple MAX results

Suppose I have a table as follows:

loan:
no  | credit
-------------
L1  | 600
L2  | 550
L3  | 800
L4  | 800
L5  | 700

If I want to find the max loan I can simply do this:

SELECT MAX(l.no)
FROM loan l
WHERE l.credit = (SELECT MAX(l.credit) from loan l)

But this would only return me one loan. Is there a way to display both L3 and L4 without making a complicated query?

Aucun commentaire:

Enregistrer un commentaire