user1544327
user1544327

Reputation: 117

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

Upvotes: 0

Views: 79

Answers (1)

hotfix
hotfix

Reputation: 3396

try this one :

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

Upvotes: 3

Related Questions