Search code examples
oracle-databaseoracle-apexoracle-apex-5

How to use Max in the where clause


I need to count latest date records (REPORT_DATE column).

It will be very helpful if I get this in the where clause

Select count(*) FROM DATA_EXPORT WHERE
REPORT_DATE = MAX(REPORT_DATE)

ORA-00934: group function is not allowed here


Solution

  • try this one :

    Select count(*) 
      FROM DATA_EXPORT 
     WHERE REPORT_DATE = (select MAX(REPORT_DATE) from  DATA_EXPORT)
       AND STATUS = 'Open'