I want to display the employees who have joined in last two
months. (It should be executed randomly means If I execute
the query in March it should display Jan and Feb joined
employees. Same query if i execute in Feb, 2007 it should
display dec, 2006 and jan 2007 joined employees.

Answer Posted / raji_4u

select *
from emp
where hiredate
between add_months(trunc(sysdate,'Month'),-2)
and trunc(sysdate,'Month')-1

This works for sure. 100 %

Is This Answer Correct ?    14 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is sql and db2?

525


What is nosql vs sql?

553


Define select, insert, create, delete, update, drop keywords

592


What can sql server reporting services do?

571


What is the difference between view and stored procedure?

483






What is sql*plus?

560


What is rollback?

571


how is exception handling handled in mysql? : Sql dba

538


what is unique key constraint? : Sql dba

558


If a cursor is open, how can we find in a pl/sql block?

663


why does the selected column have to be in the group by clause or part of an aggregate function? : Sql dba

546


What is mutating sql table?

596


What does select count (*) mean in sql?

535


what are date and time functions in mysql? : Sql dba

526


What are % type and % rowtype?

562