I am trying to get the AMOUNT_APP WHERE DATE _APP is the greatest value.
I wrote this query, but I am having troubles
SELECT AMOUNT_APP
FROM Payments_App
WHERE DATE_APP = MAX(DATE_APP)
I expect to get 5234.34
I am trying to get the AMOUNT_APP WHERE DATE _APP is the greatest value.
I wrote this query, but I am having troubles
SELECT AMOUNT_APP
FROM Payments_App
WHERE DATE_APP = MAX(DATE_APP)
I expect to get 5234.34
 
    
    Use order by and rownum:
select pa.amount_app
from (select pa.*
      from payments_app
      order by date_app desc
     ) pa
where rownum = 1;
Or keep can be quite efficient:
select max(pa.amount_app) keep (dense_rank first order by date_app desc)
from payments_app;
 
    
    If we suppouse that DATE_APP is an attribute that you could find the most recently updated results.
select AMOUNT_APP FROM Payments_App WHERE DATE_APP = (Select MAX(DATE_APP) FROM Payments_App) ;
