Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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

take Mon(like sep,oct,mar etc)
and year( like 2006,2007,1980 etc) as input...
and execute this query..

select empno,ename,hiredate from emp1
where hiredate between
add_months(to_date('01-'|| upper('&Mon')||'-'||&yr,'DD-MON-
YYYY'),-2) and last_day(add_months(to_date('01-'|| upper
('&Mon')||'-'||&yr,'DD-MON-YYYY'),-1))

Is This Answer Correct ?    3 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is a database event trigger?

1211


What is the difference between row level and statement level trigger?

1072


What is data profiling in sql?

1138


How to select the Nth maximum salary from Table Emp in Oracle SQL Plus ?

1146


Do triggers have restrictions on the usage of large datatypes, such as long and long raw?

1223


Can we call dml statement in function?

1099


Why is normalization important?

1082


How to get help at the sql prompt?

1163


What is the purpose of design view?

1076


What is an invalid partition table?

1065


write an sql query to find names of employee start with 'a'? : Sql dba

1089


How do you use a while loop in pl sql?

1055


What is a Mapplet?

1197


what is data manipulation language? : Sql dba

1068


Mention what does plv msg allows you to do?

1164