4
I put together a spreadsheet to facilitate the understanding of my doubt.
How to select only the 2 "two" largest room house tuition?
I only managed to bring the highest value of each room, I wanted to bring the 2 highest monthly fees of each room. Someone could give me a light?
SELECT E.ID_SALA,
(SELECT MAX(E2.MENSALIDADE)
FROM ESCOLA E2
WHERE E2.ID_SALA = E.ID_SALA)
AS MAIOR_VALOR
FROM ESCOLA E
GROUP BY E.ID_SALA
ORDER BY E.ID_SALA;
Bank example
Query result I’m trying to get
And when there’s shock of
e.mensalidade
?– Jefferson Quesado
@Jeffersonquesado a
rank
different will be given to each of the records, even the same– Sorack