Q) How to Find Max Date from each Group? (Asked in Infosys
(INFI)Interview)

Answer Posted / d ashwin

AS OUR EXAMPLE HR SCHEMA FOR GROUP WISE MAX DATE...

SELECT * FROM HR.EMPLOYEES
WHERE HIRE_DATE IN
(SELECT MAX(HIRE_DATE) FROM HR.EMPLOYEES
GROUP BY DEPARTMENT_ID);

FOR SINGLE ROW MAX DATE...
SELECT * FROM
(
SELECT * FROM HR.EMPLOYEES
ORDER BY HIRE_DATE DESC)
WHERE ROWNUM = 1;

Is This Answer Correct ?    4 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Explain an exception and its types?

611


How to set a transaction to be read only in oracle?

582


What is recovery manager(rman) backup in Oracle?

629


Why do you create or replace procedures rather that drop and recreate.

548


How to use "in" parameter properly?

618






How to create an oracle testing table?

591


How to define a data source name (dsn) in odbc manager?

529


How to update values on multiple rows in oracle?

602


How to create a new table by selecting rows from another table?

553


What is dynamic proxy?

554


Assuming that you are an End User How to find that in the payment Batch some of the Invoice was  Missing To pay How to find That??

1272


What is the Tune Query

1846


What are the differences between char and varchar2 in oracle?

565


How to recover a dropped table in oracle?

605


What is a named program unit?

580