I want to do a select in oracle that returns more or less 300 rows, but I just want the 12 last registries. Here is the query:
(SELECT *
FROM series
ORDER BY odata DESC) estatisticas
WHERE ponteiro = 50 AND lotus = 30
Something along the lines of:
select * from
( select estatisticas, rownum rn
(SELECT *
FROM series
ORDER BY odata DESC) estatisticas
WHERE ponteiro = 50 AND lotus = 30
order by odata asc) where rownum <=12
Edit: updated it for your query, you want to sort it opposite of the inner query, ascending in your case, so you can get the last 12
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With