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 / shanmukha srinivas

1)last two months joined employees
select * from emp where hiredate between add_months(trunc(sysdate,'month'),-2) and trunc(sysdate,'month')
2)last two months joined employees from today

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

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are different types of keys?

529


how to enter characters as hex numbers? : Sql dba

574


What is the difference between union and union all command?

557


How to avoid using cursors?

599


who introduced sql?

572






Why we use triggers in mysql?

560


What is error ora-12154: tns:could not resolve the connect identifier specified?

595


What is a sql instance vs database?

582


How many functions are there in sql?

544


what is 'mysqladmin' in mysql? : Sql dba

536


What sql database should I use?

553


How delete all data from all tables in sql?

540


Which command is used to call a stored procedure?

505


how to use like conditions? : Sql dba

582


What is sql in oracle?

627