Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Query to get monthly Data

KarkiAug 31 2014 — edited Sep 2 2014

Hi Friends,

In my table Employee Details is stored as: 

EmployeeNameDepartmentPositionManagerEffective_FromEffective_To
LeoSalesSalesmanHing1-Jan-1431-Mar-14
LeoSalesSalesmanKeon1-Apr-1430-Sep-14
TinSalesSalesmanJohn1-Jun-1431-Dec-14
LeoSalesSalesmanJohn1-Oct-1431-Dec-14

Effective_From and Effective_to are date column which specify the time during which an employee reports to a particular manager. e.g. Leo report to Hing from Jan to Mar, Leo report to Keon from Apr to Sep and reported to John from Oct to Dec.

Also Tin data start from Jun month and he reported to John from Jun to Dec.

I need to prepare a view on above table which can give me monthly data as:

     

EmployeeNameDepartmentPositionManagerData_Month
LeoSalesSalesmanHingJanuary
LeoSalesSalesmanHingFebrary
LeoSalesSalesmanHingMarch
LeoSalesSalesmanKeonApril
LeoSalesSalesmanKeonMay
LeoSalesSalesmanKeonJune
LeoSalesSalesmanKeonJuly
LeoSalesSalesmanKeonAugust
LeoSalesSalesmanKeonSeptember
LeoSalesSalesmanJohnOctober
LeoSalesSalesmanJohnNovember
LeoSalesSalesmanJohnDecember
TinSalesSalesmanJohnJune
TinSalesSalesmanJohnJuly
TinSalesSalesmanJohnAugust
TinSalesSalesmanJohnSeptember
TinSalesSalesmanJohnOctober
TinSalesSalesmanJohnNovember
TinSalesSalesmanJohnDecember

Kindly help.

This post has been answered by RajenB on Aug 31 2014
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 30 2014
Added on Aug 31 2014
3 comments
2,331 views