All Months between Start date and add_months(start_date,12)
DBAsupport.com Forums - Powered by vBulletin
Results 1 to 2 of 2

Thread: All Months between Start date and add_months(start_date,12)

  1. #1
    Join Date
    Sep 2008
    Posts
    8

    All Months between Start date and add_months(start_date,12)

    Hi everyone,hope eveyone doing great! I am new to this forum and i would like to learn new things and suggessions.

    I am getting a problem while resolving a scenario to load the dates and corresponding slaries.

    I have employee table and Time_Dim tables in my DW

    Employee table has columns like Emp_id,emp_start_month,emp_end_month, emp_type and annual_sal
    Time_Dim table has columns like f_date,f_month_number,f_month_name like that

    Now my scenario is

    Based on Emp_type and Emp_start_date i want to calcualte emp_salary for each month.

    I want to show each emp salary for every month.

    If EMP_TYPE = 'MANAGER' then (total_sal/add_months(emp_start_dt,12))

    i want to do it like above, but it has to display for all the months like jan, feb,mar

    My hard time is tp define a filed that shows each month name and number in a Cursor.

    I attached a test case that will show the actual data and desired data(how i want to display).


    Please let me know if that is not clear


    Thanks in Advace to everyone
    Attached Files Attached Files

  2. #2
    Join Date
    Sep 2008
    Posts
    8

    Diplay month name and number

    Hi all, here i am attaching the test case with the details. Please let me know if this is not clear

    If type= 'MANAGER' then totl_sal/(start + 12 months)
    If type = 'CONTRACTOR' then total_sal/(end_date - start_date)

    For the above criteria, i want to display all the months with monthly sal.

    Hope you all undertand it.

    Thanks in advance
    Attached Files Attached Files

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Click Here to Expand Forum to Full Width