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 / pracheth

select * from temployees where to_char(hiredate,
'month') in
(to_char(trunc(sysdate,'month')-30,'month'),to_char(trunc(sysdate,'month')-60,'month'))

Is This Answer Correct ?    0 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

what is union, minus and interact commands? : Sql dba

645


Explain select statements in sql?

575


What are the uses of merge?

708


which command using query analyzer will give you the version of sql server and operating system? : Sql dba

513


How do I run a script in sql developer?

480






How do I find duplicates in a single column in sql?

521


Which is faster joins or subqueries?

539


What is sql select statement?

492


how can we destroy the session, how can we unset the variable of a session? : Sql dba

534


What are % type and % rowtype?

560


Is it possible to read/write files to-and-from PL/SQL?

644


How many joins can you have in sql?

502


What is assignment operator in pl sql?

549


What is the use of partition by in sql?

506


Does varchar need length?

505