How to find the Max records from the available records, I have oracle database and I wanted to write statement that returns the most recent revision date with the set of Records.. If anyone knows about this please let me know.
How to find the Max records from the available records, I have oracle database and I wanted to write statement that returns the most recent revision date with the set of Records.. If anyone knows about this please let me know.
Select the max of your date column, and use a where clause about that column only for date less than today.
You can't group by GRP and also select ID. This doesn't make sense, because (to the DB) you might have two IDs with the same maximum DATE and GRP.Code:select a.sal from emp a where 1=(select distinct(count(b.sal)) from emp b where a.sal<=b.sal); for second max select a.sal from emp a where 2=(select distinct(count(b.sal)) from emp b where a.sal<=b.sal)
The number of factors that influences performance are so great that the best you could do is test both alternatives. you may use this query to join it with another query containing the IDs, If the response time is not good enough, then you must send details like:
SELECT MAX(ID) as maxid, GRP, MAX(DATE) AS max_date
FROM table
GROUP BY GRP
Bookmarks