Getting employee data year wise in different coulmns

My employee table consists of employee data and hiredate.I want the output to be in the following way
total numer of employees,employees hired in 1995,1996,1997,1998 in different columns.
can anyone help me in doing this
Thanks
Kiranmayee

user10486303 wrote:
My employee table consists of employee data and hiredate.I want the output to be in the following way
total numer of employees,employees hired in 1995,1996,1997,1998 in different columns.Like this?
SQL> select * from emp;
     EMPNO ENAME      JOB              MGR HIREDATE         SAL       COMM     DEPTNO
      7369 SMITH      CLERK           7902 17-DEC-80        800                    20
      7499 ALLEN      SALESMAN        7698 20-FEB-81       1600        300         30
      7521 WARD       SALESMAN        7698 22-FEB-81       1250        500         30
      7566 JONES      MANAGER         7839 02-APR-81       2975                    20
      7654 MARTIN     SALESMAN        7698 28-SEP-81       1250       1400         30
      7698 BLAKE      MANAGER         7839 01-MAY-81       2850                    30
      7782 CLARK      MANAGER         7839 09-JUN-81       2450                    10
      7788 SCOTT      ANALYST         7566 19-APR-87       3000                    20
      7839 KING       PRESIDENT            17-NOV-81       5000                    10
      7844 TURNER     SALESMAN        7698 08-SEP-81       1500          0         30
      7876 ADAMS      CLERK           7788 23-MAY-87       1100                    20
      7900 JAMES      CLERK           7698 03-DEC-81        950                    30
      7902 FORD       ANALYST         7566 03-DEC-81       3000                    20
      7934 MILLER     CLERK           7782 23-JAN-82       1300                    10
14 rows selected.
SQL> ed
Wrote file afiedt.buf
  1  with emp1 as (select rownum rn, emp.empno
  2                from   emp
  3                where  to_number(to_char(emp.hiredate,'YYYY')) = 1980)
  4      ,emp2 as (select rownum rn, emp.empno
  5                from   emp
  6                where  to_number(to_char(emp.hiredate,'YYYY')) = 1981)
  7      ,emp3 as (select rownum rn, emp.empno
  8                from   emp
  9                where  to_number(to_char(emp.hiredate,'YYYY')) = 1982)
10      ,emp4 as (select rownum rn, emp.empno
11                from   emp
12                where  to_number(to_char(emp.hiredate,'YYYY')) = 1987)
13  --
14  select emp1.empno as "1980", emp2.empno as "1981", emp3.empno as "1982", emp4.empno as "1987"
15  from emp1 full outer join emp2 on (emp1.rn = emp2.rn)
16            full outer join emp3 on (COALESCE(emp1.rn, emp2.rn) = emp3.rn)
17*           full outer join emp4 on (COALESCE(emp1.rn, emp2.rn, emp3.rn) = emp4.rn)
SQL> /
      1980       1981       1982       1987
      7369       7499       7934       7788
                 7521                  7876
                 7698
                 7844
                 7566
                 7902
                 7782
                 7839
                 7654
                 7900
10 rows selected.
SQL>

Similar Messages

  • Need to get rolling sum year wise in a query.

    Hi all,
    I have a table with monthid and amt columns. values are like
    200501 5
    200502 6
    200503 6
    200601 7
    200602 8
    200603 9
    Like this i have data for all months in year. now i need to get rolling sum year and
    month wise. the output should be like
    200501 5
    200502 11
    200503 17
    200601 7
    200602 15
    200603 24
    please help me out to write a query for this.
    Thanks,
    Chandu

    May be you want this
    dev>select deptno,ename, sal,
      2                    sum(sal)over(partition by deptno order by ename)as sum_on_dept
      3                 from emp;
        DEPTNO ENAME                                                     SAL SUM_ON_DEPT
            10 CLARK                                                    2450        2450
            10 KING                                                     5000        7450
            10 MI_LL_ER                                                 1300        8750
            10 T*_1NU                                                   2000       10750
            20 ADAMS                                                    1100        1100
            20 FO__RD                                                   3000        4100
            20 JONES                                                    2975        7075
            20 SCOTT                                                    3000       10075
            20 SH_*U                                                    3200       13275
            20 SMITH                                                     800       14075
            30 ALLEN                                                    1600        1600
            30 BLAKE                                                    2850        4450
            30 JAMES                                                     950        5400
            30 MARTIN                                                   1250        6650
            30 TURNER                                                   1500        8150
            30 WARD                                                     1250        9400
            30 DEEP                                                   3000       12400
               D.EV                                                     5000        5000

  • How to get release date of PR  at different levels of releasing strategy

    Hi All,
    In the releasing strategy of PR we have three levels R1 R2 & R3.
    Suppose a PR is release at R1 level on 01.01.2009
                                         at R2 level on 03.01.2009
                                         at R3 level on 05.01.2009.
    How will I come to know the relese date at all the three levels of a PR.
    Please help.
    Thanks ,
    Salman Zahir

    Hi Salman,
    IT is not depend on the mateail number.
    Based on object class 'EINKBELEG' and object id 'u r PR number*  U can get the record from CDHDR.
    In CDPOS u will have file fieldname also for which field u have 'Chnage document' check  box is checked then those deails will be stored in.
    Look at the FM 'CHANGEDOCUMENT_READ_HEADERS' and 'CHANGEDOCUMENT_READ_POSITIONS'
    Get back to me if you need any help.
    Thanks,

  • Get employee data

    Hello,
    Iam facing a problem with the func module RHXSS_SER_GET_EMPLOYEE_DATA  which takes longer time to load and is slow while executing any related transaction.
    Please share your inputs if anyone worked on this function module.
    Thanks,
    Vinod

    Hello Vinod
    An alternative approach is described in:
    [Unified Access to All HR Infotypes |https://wiki.sdn.sap.com/wiki/display/Snippets/UnifiedAccesstoAllHR+Infotypes]
    Gruss
      Uwe

  • How to display values year wise in a request

    Hi All,
    My requirement is I have 3 years of data. I need to display that data year-wise in different tables at a time i.e., suppose if i have 2010,2011,2012 data then i need to display 2010 data in one table ,2011 data in next table and 2012 data in another table in same request. At a time i should get all three years of data but in different tables.
    Here table in the sense data should be separated year_wise.
    How can I achieve this?
    Thanks in Advance,
    Regards,
    Sindhu

    Hi,
    It is good know you got your requirement.
    Pivot table is on of the specialized view we are using to create the report. The options available in the view is same like Microsoft Excel Pivot table view.
    Pivot table optioins:
    Page: It is like prompt in the view itselft. If we are adding column in the page it will show all the values of that column for e.g if you are adding year column into that page tab it will show the values of the year, so we can select any particular year and can filter the report in the view itself.
    Section: It will separate the report into different section by the column value which we are having in section tab.
    Measures: It is the special place for adding number columns (e.g amount, employee count, quantity,revenue and etc, like that ) basically called measures in the fact table. The column dragged into the measures have special aggregation rules such as sum, min, max, avg,count and etc
    excluded: if want to add any column in the saved request but donot want to display, you can drag that column into excluded tab.
    Rows: These option will display the report by value of the column wise.
    Columns: It will separate the measure value by the column what we are having in this tab. (for e.g if we are putting year in column tab the column 'Revenue' in the measure table will be separated by year wise.
    Please mark the answer if it helpful.

  • [ASK] How to get system date and substring / concate in data manager dynami

    Hello guys.
    I want to run package DM with the input have default value.
    The selection is look like this :
    Dimension : CATEGORY
    Source : PLAN_2011
    Destination : FORECAST_2011
    Dimension : TIME
    Source : 2011.JAN,2011.FEB,2011.MAR,2011.APR,2011.MAY,2011.JUN,2011.JUL,2011.AUG,2011.SEP,2011.OCT,2011.NOV,2011.DEC
    Destination : <same>
    How to get system date year and do the substring / concate ?
    So dimension category source will be PLAN_<YYYY>, destination = FORECAST_<YYYY>
    Dimension source = <YYYY>.JAN,<YYYY>.FEB,<YYYY>.MAR,<YYYY>.APR,<YYYY>.MAY,<YYYY>.JUN,<YYYY>.JUL,<YYYY>.AUG,<YYYY>.SEP,<YYYY>.OCT,<YYYY>.NOV,<YYYY>.DEC
    Depend on year system date.
    Thank you.

    Stuart,How are you storing OnSaleDate. If you are using OnSaleDate as an attribute dimension then you can write a Custom Defined Function to either:1- query your system for the current date and return the number of seconds that have elapsed since 1/1/1970. This is by definition the begining of the Epoch and how Essbase treats Attribute Dimensions of the Date type.public static long getDateInSeconds() {           Calendar cal = Calendar.getInstance();           return cal.getTime().getTime()/1000;}2- Write a Custom Defined Function that will accept the OnSaleDate and return the number of days sincepublic static double daysSince(double myDate) {     return (getDateInSeconds()-myDate )/86400;}

  • How to get data with out having any date/timestamp columns by year wise

    hi,
    how can i select years wise rows from tables,if that have not any date/timestamp column.

    Well Govind it quite depends on what is the data type of that column and the format in which it is stored.
    If the data type is varchar2/varchar and all the values are in a uniform format then there is no problem. All you need to use is the to_date function to convert the supplied strings to default date format and then use to_char function to only extract the YY or YYYY or RR or RRRR aspect of the data.
    For example: If the column is called 'hire_date' and it's data type is varchar2 and the entries in this column are all in a uniform format, say month,date,year like January,12,1999. What you need to do is convert this string to a default date value using to_date function, like to_date(hire_date,'format_model') In the format model mention the format of the hire_date string. The out put of this function can be fed into to_char to extract the year, like to_char(output_of_to_date,'YYYY')
    I hope you got what I meant. Let me know if it was of any use.

  • Can i get month, quarterly, half yearly, yearly wise sales report basing on

    hi,
    sap gurus,
    good evening to all,
    how can i get month, quarterly, half yearly, yearly wise sales report basing on division and material.
    is there any std transaction code for that.
    customization is requried for that.
    regards,
    balaji.t
    09990019711

    Standard SAP SD Reports:=
    Statistic Group:
    Purpose u2013 To capture data for Standard Reports, we require to activate Statistic Group as under:
    --> Item category (Configuration)
    --> Sales document type (Configuration)
    --> Customer (Maintain in Master data)
    --> Material (Maintain in Master data)
    When you generate statistics in the logistics information system, the system uses the combination of specified statistics groups to determine the appropriate update sequence. The update sequence in turn determines for exactly which fields the statistics are generated.
    Configuration:
    IMG --> Logistics Information System (LIS) --> Logistics Data Warehouse --> Updating --> Updating Control --> Settings: Sales --> Statistics Groups -->
    1. Maintain Statistics Groups for Customers
    2. Maintain Statistics Groups for Material
    3. Maintain Statistics Groups for Sales Documents
    4. Assign Statistics Groups for Each Sales Document Type
    5. Assign Statistics Groups for each Sales Document Item Type .....
    All Standard Reports which are available are as under:
    SAP Easy Access: Information Systems -> Logistics -> Sales and distribution ->
    1. Customer -> Incoming orders / Returns / Sales / Credit memos / Sales activities / Customer master / Conditions / Credit Master Sheet
    2. Material -> Incoming orders / Returns / Sales / Credit memos / Material master / ...
    3. Sales organization -> Sales organization / Sales office / Sales employee
    4. Shipping point -> Deliveries / Returns
    5. SD documents -> Orders / Deliveries / Billing documents ...
    & so on.
    Regards,
    Rajesh banka

  • To get first date and end date after entering any month and year

    Hi,
    I need to to get first date and end date of a month and year in yyyyMMdd format. I am reading month and year from a properties file. But I don't know how to get the first date and End date in given format. The properties file gives me just text. But I don't know how to get the date format using this. I need this urgently. Can anyone help me to get code for this?
    I am reading the fields as,
    Properties props = new Properties();
    props.load(new FileInputStream("AnyMonthVolume.properties"));
    String date_month = props.getProperty("date_month");
    String date_year = props.getProperty("date_year");
    Thanks.

    I know this has been posted a while ago but incase someone looking for it, here is the code to get the end of current month date.
    Calendar cal = Calendar.getInstance();
         cal.setTime(new java.util.Date());
         cal.set(Calendar.DATE, 1); //set the date to start of month
         cal.add(Calendar.MONTH,1);
         cal.add(Calendar.DATE,-1);
    System.out.println(cal.getTime());

  • How to get a date on different pages?

    Hey everyone, I am working on a daily planner for the office and have a script that automatically generates the dates but I don´t know how to get each of the dates on a different page. I'd really appreciate if anyone could help me get each date generated by the script on teh following page of my 365 page document. The scrip is:
    var months = [ "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" ];
    var length = [ 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 ];
    var days = [ "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" ];
    count = 0;
    day = 0;
    month = 0;
    weekday = 5;
    str = "";
    while (count < 365)
    count++;
    str += days[weekday]+", "+(day+1)+" "+months[month]+"\r";
    day++;
    if (day >= length[month])
      day = 0;
      month++;
      if (month > 11)
       month = 0;
    weekday = (weekday+1) % 7;
    app.selection[0].contents = str;
    Tanks!

    Try this,
    app.activeDocument.viewPreferences.rulerOrigin = RulerOrigin.pageOrigin;
    app.activeDocument.zeroPoint = [0,0];
    with(app.activeDocument.viewPreferences){
        horizontalMeasurementUnits=MeasurementUnits.points;
        verticalMeasurementUnits=MeasurementUnits.points;
        rulerOrigin=RulerOrigin.pageOrigin;
    var months = [ "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" ];
    var length = [ 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 ];
    var days = [ "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" ];
    count = 0;
    day = 0;
    month = 0;
    weekday = 5;
    str = [];
    while (count < 365)
    count++;
    str[count]= days[weekday]+", "+(day+1)+" "+months[month]+"\r";
    str1 =str.toString();
    day++;
    if (day >= length[month])
      day = 0;
      month++;
      if (month > 11)
       month = 0;
    weekday = (weekday+1) % 7;
    for(i=0;i<document.pages.length;i++)
    var myTextframe = document.pages[i].textFrames.add({geometricBounds:[0,0,50,150]});
    myTextframe.insertionPoints[0].contents=str[i+1];
    Vandy

  • I am having trouble getting a numbers spreadsheet to hold different formats in the same column.  A column with a date formatted heading will not convert to $ for the cells below.   Any suggestions would help.

    I am having trouble getting a numbers spreadsheet to hold different formats in the same column.  A column with a date formatted heading will not convert to $ for the cells below.   Any suggestions would help.

    Hi Wayne,
    Thank you for this response.  I have tried this but when I start enterring $ amounts some, such as $6.00, go in OK others such as $4.00 appear as a date ie 4 Oct 12.  
    Kind regards
    Paul

  • I am an MBA student , doing a research project on e-learning authoring tools, would like to find out no. of licences sold/active to date for adobe captivate. how many get sold every year. any pointers/help is appreciated. cheers.

    I am an MBA student , doing a research project on e-learning authoring tools, would like to find out no. of licences sold/active to date for adobe captivate. how many get sold every year. any pointers/help is appreciated. cheers.

    I doubt you'll get an answer in a user forum, sorry. This forum is meant for users to help other users when they have problems that have to be solved. You should contact Adobe itself.

  • In mdx how to get max date for all employees is it posible shall we use group by in mdx

    in mdx how to get max date for all employees is it posible shall we use group by in mdx
    example
    empno  ename date
    1         hari        12-01-1982
    1         hari        13-06-2000
    by using above data i want to get max data

    Hi Hari3109,
    According to your description, you want to get the max date for the employees, right?
    In your scenario, do you want to get the max date for all the employees or for each employee? In MDX, we have the Max function to achieve your requirement. You can refer to Naveen's link or the link below to see the details.
    http://www.sqldbpros.com/2013/08/get-the-max-date-from-a-cube-using-mdx/
    If this is not what you want, please provide us more information about the structure of you cube, so that we can make further analysis.
    Regards,
    Charlie Liao
    TechNet Community Support

  • Year Wise Data in SQL Express

    Hi...
    Can any one help for How to maintain year wise data in sql server. 
    In my project i manage year wise data i.e 1st April to 31 march.
    At the end of the year the current year closing balances need to update as opening balance for the next year and previous data wont be changed.
    And i dont know how to  create year wise folders in one database....
    Please show me some suggestion...

    Hi
    According to your description, we got that you want to manage year wise data in one database. You can try to create a partitioned table with a Year column to store all the data. The partitioning feature is supported in SQL Server 2005 and later versions of
    SQL Server. There are four major steps for implementing partitioning.
    1. Create a filegroup or filegroups and corresponding files that will hold the partitions specified by the partition scheme.
    2. Create a partition function that maps the rows of a table into partitions based on the values of a specified column.
    3. Create a partition scheme that maps the partitions of a partitioned table to the new filegroups.
    4. Create or modify a table and specify the partition scheme as the storage location.
    For how to create a partitioned table, please review the following links:
    Create Partitioned Tables and Indexes:http://msdn.microsoft.com/en-us/library/ms188730.aspx
    Creating a table with horizontal partitioning in SQL Server:
    http://www.mssqltips.com/sqlservertip/1796/creating-a-table-with-horizontal-partitioning-in-sql-server/
    Thanks
    Lydia Zhang

  • Function module to get the dates from the year and the period

    Is there a function Module to get the dates from the year and the period

    Check with :
    To get last day of period use .
    LAST_DAY_IN_PERIOD_GET.
    To get last of month Use :
    RE_LAST_DAY_OF_MONTH
    HRVE_LAST_DAY_OF_MONTH
    LAST_DAY_OF_MONTHS
    ISB_PREVIOUS_PERIOD_DATE_GET
    Thanks
    Seshu

Maybe you are looking for

  • Daily, WTD, and MTD detail based on 0CAL_DAY

    I am trying to set up a report to disply daily, WTD, and MTD based on cal_day, but am having trouble getting the WTD or MTD.  I'm either able to get the WTD detail, but the MTD will look like the WTD or vice versa.  I've tried different variables, hi

  • Finder & Quicklook image size

    Hi,  Sometime ago, I noticed that Quicklook started showing smaller versions of images rather than zoomed to fill the screen, then today, when I click on an image in column-view in Finder, I get little thumbnail size previews in the far right column

  • XDCAM Plugin?

    Does anyone know when the announced plugin from Sony for XDCAM for FCP X 10.0.1 will be released? And where it will be located? Thanks

  • Weblogic server crash

    I need help.....I've been getting this error and I can't resolve this issue...please help..below are the error that I get... An unexpected exception has been detected in native code outside the VM. Unexpected Signal : 11 occurred at PC=0xfe7de06c Fun

  • BBM contacts lost after updating software, even though everything else was saved

    hi recently updated my phone and did choose to back it up. everything was backed up except my bbm contact list, anyway i can restore this??? pleeeeeeaaaaaaaassssssseeeee help!!