Getting cummulative sum of salaries of employees from emp table

Hi gurus,
Can any body tell me how to get cummulative sum of salaries of employees in emp table by using analytical functions.
thanks in advance....

SeánMacGC wrote:
Hello,
Try:
SELECT empno,
SUM(SAL) OVER () cumulative_sal
FROM emp;
You need to order by to get the cumulative salary
SQL> SELECT empno,
  2     SUM(SAL) OVER () cumulative_sal
  3    FROM emp;
     EMPNO CUMULATIVE_SAL
      7369          29025
      7499          29025
      7521          29025
      7566          29025
      7654          29025
      7698          29025
      7782          29025
      7788          29025
      7839          29025
      7844          29025
      7876          29025
     EMPNO CUMULATIVE_SAL
      7900          29025
      7902          29025
      7934          29025
14 rows selected.
SQL> SELECT empno, sal,
  2     SUM(SAL) OVER (Order by empno) cumulative_sal
  3    FROM emp;
     EMPNO        SAL CUMULATIVE_SAL
      7369        800            800
      7499       1600           2400
      7521       1250           3650
      7566       2975           6625
      7654       1250           7875
      7698       2850          10725
      7782       2450          13175
      7788       3000          16175
      7839       5000          21175
      7844       1500          22675
      7876       1100          23775
     EMPNO        SAL CUMULATIVE_SAL
      7900        950          24725
      7902       3000          27725
      7934       1300          29025
14 rows selected.

Similar Messages

  • Fetching ename who are all having max(sal) in each of job from emp table

    hi all,
    i need a query to fetch all the ename who are all having maximum salary in each job category from emp table
    thankx in advance
    regrds,
    punith

    SQL> select ename,job,sal
      2  from emp
      3  order by job,sal desc;
    ENAME      JOB              SAL
    SCOTT      ANALYST         3000
    FORD       ANALYST         3000
    MILLER     CLERK           1300
    ADAMS      CLERK           1100
    JAMES      CLERK            950
    SMITH      CLERK            800
    JONES      MANAGER         2975
    BLAKE      MANAGER         2850
    CLARK      MANAGER         2450
    KING       PRESIDENT       5000
    ALLEN      SALESMAN        1600
    TURNER     SALESMAN        1500
    WARD       SALESMAN        1250
    MARTIN     SALESMAN        1250
    14 rows selected.
    SQL> select ename,job,sal from emp
      2  where sal in(select distinct max(sal) from emp
      3* group by job)
    SQL> /
    ENAME      JOB              SAL
    FORD       ANALYST         3000
    SCOTT      ANALYST         3000
    MILLER     CLERK           1300
    JONES      MANAGER         2975
    KING       PRESIDENT       5000
    ALLEN      SALESMAN        1600
    6 rows selected.
    SQL>Is this what you need ?

  • Can VLOOKUP, OFFSET, INDEX and MATCH be used to SUM the value of cells from multiple tables?

    I have a problem thats needs a sulution. I have a Spreadsheet with multiple sheets and tables. The (Truck ) Sheets each represent a "Site" and the tables within from 1-31 show inventory counts for each day of the month.
    Shown below are Edited example's of a "Site" sheet and the Day tables contained within it.
    The Spreadsheet expands as a new "Site" (Truck ) is added regularly. Currently there are 30 "Sites" (Trucks).
    Also within the spreadsheet is a sheet (Checkpoint) which contains tables used to show summary data for each "Site" sheet. There is one table used to review one site, so currently there are 30 tables identical in format and structure reviewing 30 sites.
    An edited example of the summary table for Truck 1 is shown below.
    The table's in CP reference data within cells from other sheets. A LEN INDIRECT formula
    =IF(LEN(INDIRECT("Truck 1::Day "&COLUMN(cell)−3&"::K53",addr-style))<1,"",INDIRECT("Truck 1::Day "&COLUMN(cell)−3&"::k53",addr-style))
    was used to retrieve the values within certain cells. This formula works perfectly because when I add another "Site" I simply need to Dupicate a "Site" Template Sheet and then Copy Paste the LEN INDIRECT formula in to the newly created Summary table. 
    There is another sheet (Command Central) which contains a Master summary table. The Master Summary sheet is identical in structure to the CP Summary Tables. Its purpose is to show the combined data from the tables within Checkpoint (Truck 1-30). for instance MS::D5=Checkpoint::Truck 1:Truck 30::D5. I realize that Numbers cannot calculate cells within a range of table so I am hoping for a workaround. 
    Could someone please help me with a formula something like the LEN INDIRECT formula mentioned above or possible a something else that could work beside
    D5=Truck 1::D5,Truck 2::D5,Truck 3::D5...?
    When I use that formula type I will have to edit the formula every time I add a new site.
    Anothe issue Im having is getting D3:AH3 to show the correct count of names. I am using the following formula:
    D3=SUM(COUNTA(Truck 1::D3,Truck 2::D3,Truck 3::D3,Truck 4::D3))−SUM(COUNT(UNION.RANGES(Truck 1::D3,Truck 2::D3,Truck 3::D3,Truck 4::D3)))
    The cells it is counting are either blank (the refenced cell contains a LEN INDIRECT formula that places "" if needed) or contain a name. This formula works when I and addressing cells without the LEN INDIRECT formula. What am I doing wrong?

    Hello Wayne,
    Here are screenshots of the tables in question. The first on is the Master summary table.
    Cell D5 shows the value pulled from Checkpoint::Truck 1::D5
    Cell E5 shows the value pulled from Checkpoint::Truck 2::D5
    Cell F5 shows the value pulled from Checkpoint::Truck 3::D5
    Cell G5 shows the value pulled from Checkpoint::Truck 4::D5

  • How to get the select * from emp table output on the console  using java

    public class software {
          * @param args
         static final String JDBC_DRIVER = "oracle.jdbc.driver.OracleDriver";
         static final String DATABASE_URL = "jdbc:oracle:abc";
         private static Connection connection;
         private static Statement statement;
         public static void main(String[] args) {
              // TODO Auto-generated method stub
         try {
              System.out.println("-------THIS IS THE Class.forNameJDBC_DRIVER");
                   Class.forName(JDBC_DRIVER);
                   System.out.println("THIS IS THE Class.forNameJDBC_DRIVER");
                   connection = DriverManager.getConnection(DATABASE_URL, "abc",
                   "abc");
                   System.out.println("THIS IS THE connection abc ,abc");
                   statement = connection.createStatement();
                   //Query to find the values in the EMP table.
                   ResultSet resultSet = statement.executeQuery("SELECT * from EMP");
                   if(resultSet.next()){
                   System.out.println("THESE ARE THE VALUES IN EMP TABLE:"+resultSet);  /// How can i get all the values record wise on the  console ??????
                   resultSet.close();
         catch (ClassNotFoundException classNotFound) {
                   System.out.println("Driver not Found"+classNotFound.getMessage());
              } catch (SQLException sqlException) {
                   System.out.println("SQL Exception - bad sql");
                   System.out.println(sqlException.getMessage());
    }

    1sai
    Please assign the dukes here and in your previous threads.
    See [http://wikis.sun.com/display/SunForums/Duke+Stars+Program+-+How+it+Works]
    You are currently the all time career leader in un-awarded dukes, with including this thread 75 unawarded dukes for questions you marked as answered.
    It's even worse when you look and see that you have awarded many dukes as well. So you do know how to do it. You're just too lazy and rude to be bothered.
    Don't be a lazy wank.

  • Nth Highest Salary from EMP table , need explaination

    I am new to the database world and hence learning queries at the initial stages. I want to retrieve the nth highest salary from the EMP table. I was not able to find out the answer by myself , so I searched on google. The following was the answer i got :
    SELECT DISTINCT (a.sal) FROM EMP A WHERE &N = (SELECT COUNT (DISTINCT (b.sal)) FROM EMP B WHERE a.sal<=b.sal);
    Enter value for n: 2
    SAL
    3700
    Suppose the table contains salary in the following order :
    SAL
    2000
    3000
    3700
    4000
    3700
    2000
    So how come I will get the correct answer with the abov query ? I am not able to understand the part --- WHERE &N = (SELECT COUNT (DISTINCT (b.sal)) FROM EMP B WHERE a.sal<=b.sal);
    Specially the condition WHERE a.sal<=b.sal is very confusing to me. Can anyone help me please to understand the same.

    user12328699 wrote:
    I am new to the database world and hence learning queries at the initial stages. I want to retrieve the nth highest salary from the EMP table. I was not able to find out the answer by myself , so I searched on google. The following was the answer i got :
    SELECT DISTINCT (a.sal) FROM EMP A WHERE &N = (SELECT COUNT (DISTINCT (b.sal)) FROM EMP B WHERE a.sal<=b.sal);
    Enter value for n: 2
    SAL
    3700
    Suppose the table contains salary in the following order :
    SAL
    2000
    3000
    3700
    4000
    3700
    2000
    So how come I will get the correct answer with the abov query ? I am not able to understand the part --- WHERE &N = (SELECT COUNT (DISTINCT (b.sal)) FROM EMP B WHERE a.sal<=b.sal);
    Specially the condition WHERE a.sal<=b.sal is very confusing to me. Can anyone help me please to understand the same.There is many better way to get the nth highest salary
    But still if you want to understand the same.
    Assuming the data is sorted in ascending order, then
    1) a.sal=2000, so a.sal<=b.sal results in count as 3 (not equal to user input)
    2) a.sal=3700, so a.sal<=b.sal results in count as 2 (equal to user input)
    3) a.sal = 4000 , so a.sal<=b.sal results in count as 1 (not equal to user input)
    Hence the answer is 3700
    Regards
    Anurag

  • How to display required data from emp table?

    Hi every one, this is my first post in this portal. I want display the details of emp table.. for that I am using this SQL statement.
    select * from emp where mgr=nvl(:mgr,mgr);
    when I give the input as 7698 it is displaying the corresponding records... and also when I won't give any input then it is displaying all the records except the mgr with null values.
    1)I want to display all the records when I won't give any input including nulls
    2)I want to display all the records who's mgr is null
    Is there any way to incorporate to include all these in a single query..

    Hi,
    937440 wrote:
    Hi every one, this is my first post in this portal. Welcome to the forum!
    Be sure to read the forum FAQ {message:id=9360002}
    I want display the details of emp table.. for that I am using this SQL statement.
    select * from emp where mgr=nvl(:mgr,mgr);
    when I give the input as 7698 it is displaying the corresponding records... and also when I won't give any input then it is displaying all the records except the mgr with null values.
    1)I want to display all the records when I won't give any input including nulls
    2)I want to display all the records who's mgr is null
    Is there any way to incorporate to include all these in a single query..It's a little unclear what you're asking.
    The following query always includes rows where mgr is NULL, and when the bind variable :mgr is NULL, it displays all rows:
    SELECT  *
    FROM     emp
    WHERE     LNNVL (mgr != :mgr)
    ;That is, when :mgr = 7698, it displays 6 rows, and when :mgr is NULL it displays 14 rows (assuming you're using the Oracle-supplied scott.emp table).
    The following query includes rows where mgr is NULL only when the bind variable :mgr is NULL, in which case it displays all rows:
    SELECT     *
    FROM     emp
    WHERE     :mgr     = mgr
    OR       :mgr       IS NULL
    ;When :mgr = 7698, this displays 5 rows, and when :mgr is NULL it displays 14 rows.
    The following query includes rows where mgr is NULL only when the bind variab;e :mgr is NULL, in which case it displays only the rows where mgr is NULL. That is, it treats NULL as a value:
    SELECT     *
    FROM     emp
    WHERE     DECODE ( mgr
                , :mgr, 'OK'
                )     = 'OK'
    ;When :mgr = 7698, this displays 5 rows, and when :mgr is NULL, it displays 1 row.

  • To get the sum of leave an  employee has taken

    hi all
    i have this query
    SELECT   dif.employee_number, dif.full_name employeename,
             TO_CHAR (date_entray, 'DY') DAY, date_entray attendance_date,
             TO_CHAR (start_date, 'dd-Mon-rrrr') doj, dif.dept_name, POSITION,
             tran_name, insert_type, day_desc,
             CASE
                WHEN insert_type = 'AnLv'
                   THEN COUNT
                          (insert_type)
             END days_anlv,
             CASE
                WHEN insert_type = 'SkLv'
                   THEN COUNT (insert_type)
             END days_sklv,
             CASE
                WHEN insert_type = 'BTrp'
                   THEN COUNT (insert_type)
             END days_btrp
        FROM nap_punch_data_emp_list trn, nap_emp_def dif,
             nap_punch_card_eleg ele
       WHERE trn.employee_number = dif.employee_number
         AND ele.employee_number = trn.employee_number
         AND date_entray BETWEEN :p_from_date AND :p_to_date
         AND trn.employee_number BETWEEN NVL (:p_emp_no, trn.employee_number)
                                     AND NVL (:p_emp_no2, trn.employee_number)
    GROUP BY dif.employee_number,
             dif.full_name,
             start_date,
             dif.dept_name,
             POSITION,
             tran_name,
             insert_type,
             date_entray,
             day_desc
    ORDER BY date_entray
    the output of which is
    EMPLOYEE_NUMBER     ATTENDANCE_DATE    INSERT_TYPE                            DAYS_ANLV                              DAYS_SKLV                                   DAYS_BTRP
    686                       04/18/2012          annual leave                          1
    688                        04/18/2012     sick leave                                                                         1
    689                     04/18/2012        annual leave                               1
    686                   04/19/2012        annual leave                                 1
    69                 04/19/2012          businesstrip                                                                                                                       1                         
    69               04/19/2012          businesstrip                                                                                                                         1
                is it possible to obtain
    employee number                                        days_anlv                            days_btrp
    686                                                                  2    
    69                                                                                                             2the sum of the respective leaves each employee has taken
    kindly guide
    thanking in advance
    Edited by: makdutakdu on Jun 24, 2012 2:59 PM
    Edited by: makdutakdu on Jun 24, 2012 3:00 PM
    Edited by: makdutakdu on Jun 24, 2012 3:01 PM
    Edited by: makdutakdu on Jun 24, 2012 3:02 PM
    Edited by: makdutakdu on Jun 24, 2012 3:03 PM
    Edited by: makdutakdu on Jun 24, 2012 3:03 PM
    Edited by: makdutakdu on Jun 24, 2012 3:04 PM
    Edited by: makdutakdu on Jun 24, 2012 3:26 PM
    Edited by: makdutakdu on Jun 24, 2012 3:27 PM
    Edited by: makdutakdu on Jun 24, 2012 3:28 PM
    Edited by: makdutakdu on Jun 25, 2012 9:05 AM

    Hi,
    makdutakdu wrote:
    hi all
    i have this query
    SELECT   dif.employee_number, dif.full_name employeename,
    TO_CHAR (date_entray, 'DY') DAY, date_entray attendance_date,
    TO_CHAR (start_date, 'dd-Mon-rrrr') doj, dif.dept_name, POSITION,
    tran_name, insert_type, day_desc,
    CASE
    WHEN insert_type = 'AnLv'
    THEN COUNT
    (insert_type)
    END days_anlv,
    CASE
    WHEN insert_type = 'SkLv'
    THEN COUNT (insert_type)
    END days_sklv,
    CASE
    WHEN insert_type = 'BTrp'
    THEN COUNT (insert_type)
    END days_btrp
    FROM nap_punch_data_emp_list trn, nap_emp_def dif,
    nap_punch_card_eleg ele
    WHERE trn.employee_number = dif.employee_number
    AND ele.employee_number = trn.employee_number
    AND date_entray BETWEEN :p_from_date AND :p_to_date
    AND trn.employee_number BETWEEN NVL (:p_emp_no, trn.employee_number)
    AND NVL (:p_emp_no2, trn.employee_number)
    GROUP BY dif.employee_number,
    dif.full_name,
    start_date,
    dif.dept_name,
    POSITION,
    tran_name,
    insert_type,
    date_entray,
    day_desc
    ORDER BY date_entray
    the output of which is
    EMPLOYEE_NUMBER     ATTENDANCE_DATE    INSERT_TYPE                DAYS_ANLV                              DAYS_SKLV                                   DAYS_BTRP
    686                       04/18/2012          annual leave                                     1
    688                        04/18/2012     sick leave                                                                                            1
    689                     04/18/2012        annual leave                                         1
    686                   04/19/2012        annual leave                                            1
    69                 04/19/2012          businesstrip                                                                                                                                               1                         
    69               04/19/2012          businesstrip                                                                                                                                                  1
    When posting formatted code, make sure it appears on this site so that people can read and understand it. Does the output above look okay ih your browser? I can;t tell which numbers are supposed to be in which columns. Use the "Preview" tab and edit your message, if necessarry, before posting.
    is it possible to obtain
    employee number days_anlv days_btrp
    686 2
    69 2
    the sum of the respective leaves each employee has takenIt's unclear what you want, but I'm sure you can do it.
    Whenever you have a question, post a little sample data (CREATE TABLE and INSERT statements, relevant columns only) for all the tables involved, and the results you want from that data.
    Explain, using specific examples, how you get those results from that data.
    Always say what version of Oracle you're using.
    See the forum FAQ {message:id=9360002}
    If you only want one row of output for each employee_number, then employe_number should be the only thing in the GROUP BY clause.
    You may need to do 2 GROUP BYs; one in a sub-query, and the the other (with employee_number alone in the GROUP BY clause) in the main query.
    Why do the results not include employee_numbers 688 and 689?

  • How to get  all rows of an attribute data from a table?

    Hello.. I´m using Jdev 10.1.3.2
    I have a table with 5 columns and N rows.
    I need to create a backing bean method to count the value of all rows of a specifc column.
    I use
    JUCtrlValueBindingRef selectedRowData= (JUCtrlValueBindingRef)myTable().getSelectedRowData();
    to get an attribute from a selected row. but How can get from all rows?
    Thank you
    Vandré

    Hi Vandré
    I think this example of Steve Muench will help you.
    "Recalc Sum of Salary at the View Object Level
    This example illustrates a technique where a transient attribute of a view object is updated to reflect the total sum of some attribute of all the rows in the view object's default row set. The code to recalculate the sum of the salary is in the getSumOfSal() method in the EmpViewImpl.java class. The custom EmpViewRowImpl.java class for the view row implements the getter method for the SumOfSal attribute by delegating to this view object method. The EmpViewImpl class extends a base DeclarativeRecalculatingViewObjectImpl class that contains some generic code to enable declaratively indicating that one attribute's change should recalculate one or more other attributes. The EmpView defines the "Recalc_Sal" property to leverage this mechanism to recalculate the "SumOfSal" attribute. If you restrict the VO's results using the BC Tester tool, you'll see the sum of the salaries reflects the subset. If you add a new row or delete an existing row, the sum of sal is updated, too."
    http://otn.oracle.com/products/jdev/tips/muench/recalctotalvo/RecalcTotalOfRowsInVO.zip
    Good Luck

  • Get the Last Value of Status Field from SQL TABLE using SQL 2008

    I have a table with Fields such as
    UploadstartTime, UploadEndtime, STATUS From TBLA.
    The STATUS Field, has values =7 and 11 are failed and 12 is SUCCESS. I cannot do a max, since it will always show 12, I need to get the MAX(UPLOADENDTIME, and get STATUS For that record. How can I do that using 1 SQL Query?
    My current code is: The issue is
    select
      TBLNAME
    MaxUploadstarttime
    =
    max(UploadStartTime),
    MaxUploadEndtime
    =
    max(UpLoadEndTime),
         Status=max(status)
    from  DB.DBO.LOGTABLE
    p1

    Please post DDL, so that people do not have to guess what the keys, constraints, Declarative Referential Integrity, data types, etc. in your schema are. Learn how to follow ISO-11179 data element naming conventions and formatting rules. You failed! Temporal
    data should use ISO-8601 formats. Code should be in Standard SQL as much as possible and not local dialect. 
    This is minimal polite behavior on SQL forums. 
    >> I have a table with Fields such as <<
    Fields are not columns! There is no generic status in RDBMS. Putting “tbl-” in a table name is called tibbling and we make fun of people who do it (Google Phil Factor's humor columns. If you were polite is this what you wanted to post? 
    CREATE TABLE Something_Uploads
    (upload_source_name CHAR(15) NOT NULL,
     upload_start_timestamp DATETIME2(0) NOT NULL,
     PRIMARY KEY (upload_source_name, upload_start_timestamp),
     upload_end_timestamp DATETIME2(0),
     CHECK(upload_start_timestamp < upload_end_timestamp),
     upload_status INTEGER NOT NULL 
       CHECK (upload_status IN (7,11,12, ..))
    >> I cannot do a max, since it will always show 12, I need to get the MAX(UPLOADENDTIME, and get upload_status For that record [sic]. How can I do that using 1 SQL Query?  <<
    Since you told us nothing and gave no sample data, want to correct this postign? 
    --CELKO-- Books in Celko Series for Morgan-Kaufmann Publishing: Analytics and OLAP in SQL / Data and Databases: Concepts in Practice Data / Measurements and Standards in SQL SQL for Smarties / SQL Programming Style / SQL Puzzles and Answers / Thinking
    in Sets / Trees and Hierarchies in SQL

  • How to get count of records for each type from internal table

    Hi Guys,
    I want to implement a logic to find out the count of records in a internal table.
    Assume my internal table have one field having the entries as shown below.
    Internal table Entries
    10
    10
    10
    11
    11
    12
    12
    12
    12
    13
    14
    14
    15
    15
    15
    15
    15
    16
    16
    17
    18
    19
    20
    20
    20
    ....... etc....
    I should get an output as below
    10's - 3
    11's -2 ,
    12's - 4.... etc..
    Could any one help me how to do this.
    Thanx,
    Kumar

    REPORT  zzz.
    DATA: i(100),
          t(100),
          j TYPE n.
    TYPES: BEGIN OF gt_int_type,
            linex(100) TYPE c,
           END OF gt_int_type.
    DATA: gt_int TYPE STANDARD TABLE OF gt_int_type,
          wa_int LIKE LINE OF gt_int.
    START-OF-SELECTION.
      wa_int-linex = '10'.
      APPEND wa_int TO gt_int.
      wa_int-linex = '10'.
      APPEND wa_int TO gt_int.
      wa_int-linex = '10'.
      APPEND wa_int TO gt_int.
      wa_int-linex = '11'.
      APPEND wa_int TO gt_int.
      wa_int-linex = '11'.
      APPEND wa_int TO gt_int.
      wa_int-linex = '12'.
      APPEND wa_int TO gt_int.
      wa_int-linex = '12'.
      APPEND wa_int TO gt_int.
      wa_int-linex = '12'.
      APPEND wa_int TO gt_int.
      wa_int-linex = '12'.
      APPEND wa_int TO gt_int.
      wa_int-linex = '13'.
      APPEND wa_int TO gt_int.
      wa_int-linex = '14'.
      APPEND wa_int TO gt_int.
      wa_int-linex = '14'.
      APPEND wa_int TO gt_int.
      wa_int-linex = '15'.
      APPEND wa_int TO gt_int.
      wa_int-linex = '15'.
      APPEND wa_int TO gt_int.
      wa_int-linex = '15'.
      APPEND wa_int TO gt_int.
      wa_int-linex = '15'.
      APPEND wa_int TO gt_int.
      wa_int-linex = '15'.
      APPEND wa_int TO gt_int.
      wa_int-linex = '16'.
      APPEND wa_int TO gt_int.
      wa_int-linex = '16'.
      APPEND wa_int TO gt_int.
      wa_int-linex = '17'.
      APPEND wa_int TO gt_int.
      wa_int-linex = '18'.
      APPEND wa_int TO gt_int.
      wa_int-linex = '19'.
      APPEND wa_int TO gt_int.
      wa_int-linex = '20'.
      APPEND wa_int TO gt_int.
      wa_int-linex = '20'.
      APPEND wa_int TO gt_int.
      wa_int-linex = '20'.
      APPEND wa_int TO gt_int.
      LOOP AT gt_int INTO wa_int.
        WRITE:/ wa_int-linex.
      ENDLOOP.
      ULINE.
      SKIP 3.
      SORT gt_int BY linex.
      READ TABLE gt_int INDEX 1 INTO i.
      j = 0.
      LOOP AT gt_int INTO wa_int.
        IF wa_int-linex EQ i.
          j = j + 1.
        ELSE.
          WRITE:/ i,'''s = ', j.
          j = 1.
          i = wa_int-linex.
        ENDIF.
      ENDLOOP.
      WRITE:/ i,'''s = ', j.
    consider clearing leading/trainling spaces...

  • Reg: Getting the latest or last saved data from the table

    Hi,
    I'm having a table, which is getting updated whenever something is saved.
    Now i want to get the latest or last saved details to be displayed or the details of the row with greatest Id.( i.e, the Id. will be greatest for the last saved)
    please help me out with code to do this...
    Thanks & Regards,
    Suresh

    Hi Suresh,
    This could be done either through the webdynpro or the back end function module itself.
    If another field of type date/time is present in the table, u can save the current date and time along with the data in the table, and sort it in descending order of time. so that whenever u refresh the page the latest record is always in the first row,
    if u want to do it through webdynpro, u can also sort the table based on the date so that u get the latest record that was saved.
    Another solution is that u can maintain a serial number sort of thing the table which helps u identify the latest record
    Hope this helps u.
    Regards,
    Poojith M V

  • How to get 3 maximum salaries from emp

    Hello,
    Dear fellows how can we get 3 maximum salaries from emp
    table in SQL.
    plz reply me soon
    thanks

    Does it work ?
    13:18:31 SQL> select * from my_tab1;
    A B
    1 1
    1 1
    1 1
    1 1
    1 1
    1 1
    1 1
    1 1
    8 rows selected.
    13:19:24 SQL> ed
    Wrote file afiedt.buf
    1 SELECT UNIQUE a FROM my_tab1 WHERE a>=
    2 (SELECT MAX(a) FROM my_tab1 WHERE a<
    3 (SELECT MAX(a) FROM my_tab1 WHERE a <
    4* (SELECT MAX(a) FROM my_tab1)))
    13:19:34 SQL> /
    no rows selected

  • How to get Essential and additional qualifications ,From which table

    Hi all,
    In one of my requirement, the report should show the Qualifications and Essential qualifications columns in the output.
    Requirement is :
    1. I have brought qualifications of Applicant from PB0024 table.
    2. I need to compare these with the Qualifications maintained in Job for the pernr.
    3. There are two types of Qualifications namely essential Qualifications and additional Qualifications.
    4.
    How do we get the Qualifications maintained for a job/Position?
    How can we distinguish between Qualifications and essential Qualifications maintained for a job at the database table level ?
    Please reply ASAP.
    Regards,
    Rama.P

    Hi Dilek Ersoz Adak,
    How can we get the jobs assigned to a position ,from which table ?
    Actually i am doing a custom recruitment report which displayes several fields along with the qualificaions and additional qualifications.
    For the two fileds: in the spec it is given as:
    14.     Qualification (This is maintained in HRPE_PROFQ_TBJID-infotype 0024 of the employee. Thus, check Position maintained for the employee in P4002_OBJID, against this position check for Essential Qualification, related object type u2018Qu2019 HRPE_PROFQ_ESSENTIAL, compare this with the qualifications maintained for the employee in Infotype 0024, and display wherever these maintained.)
    15.     Additional Qualification (This is maintained in HRPE_PROFQ_TBJID-infotype 0024 of the employee. Thus, check Position maintained for the employee in P4002_OBJID, against this position check for Essential Qualification, related object type u2018Qu2019, compare this with the qualifications maintained for the employee in Infotype 0024, and display all qualifications for which HRPE_PROFQ_ESSENTIAL is not maintained.)
    16.     Proficiency (HRPE_PROFQ_PROFC_TEXT)
    in clear :
    1.       Positions (Object Type S) are linked to Job through relationship A 007
    2.       In APDISCOM scenario, Qualifications (Object Type Q) are attached to Object u2018Jobu2019 (Object Type C) through Transaction Code PPPM
    3.       Now, for a Job there can two types of qualifications maintained Essential Qualifications (ii) Additional Qualifications
    4.       For essential qualifications: Against a Qualification we can maintain u201Cessential check boxu201D HRPE_PROFQ
    5.       For additional qualifications: Those qualifications for which HRPE_PROFQ is not maintained
    6.       Now, for an applicant, Qualifications are maintained in Infotype 0024, wherein the necessary qualifications would be selected.
    7.       In the report for field of u201Cessential qualificationu201D, check for qualifications maintained in Infotype 0024 and compare it with qualifications maintained in Job (through Position assigned to the applicant in P4002_OBJID)
    8.       Check for essential qualification HRPE_PROFQ maintained in Job and check whether the same Q is maintained in Infotype 0024 for the applicant, if yes, then generated Text of the Q
    9.       If there are any additional qualifications which are maintained in the job and not maintained in Infotype 0024, DONu2019T GENERATE ANYTHING IN FIELD
    10.   If there are any additional qualifications which are maintained in the job and if same are maintained in Infotype 0024, generate Q text under field of u201CAdditional Qualificationsu201D in the report
    11.   If there are any extra qualifications in infotype 0024, which are not maintained in Job, then generate Q text under field of u201CAdditional Qualificationsu201D in the report
    Please provide the procedure.(For clarity copy and paste the text in a MS-word)
    Please reply ASAP.
    Regards,
    Rama.P
    Edited by: Rama Chary on Dec 9, 2009 1:28 AM

  • Get cell value from Woodstock table

    Hello,
    I am using a Woodstock Basic Table from the NB palette.
    One of the columns is editable and I need to get the updated values upon a button click event.
    How do I get the value of a specific cell from the table?
    Thanks

    Hi Rajashekar ,
    here is the code :
    // Get a handle to the table footer bean
    OATableBean tableBean = ...;
    OATableFooterBean tableFooterBean = tableBean.getFooter();
    if (tableFooterBean != null)
    // Get a handle to the total row bean
    OATotalRowBean totalRowBean = tableFooterBean.getTotal();
    --Keerthi                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Getting description of product from another table

    Hi,
    I am getting the level from the user, and based on that creating an internal table.  I am getting product code (PRODH) and level (STUFE) from one table (T179), and getting product description (VTEXT) from another table (T179T).  I need to create a single internal table (PVS) with all three fields.
    How do I do that?  This may seem like a very simple question, but I have only been teaching myslef ABAP for about one week.
    Once I can prepare this table, I will use a function to display it.
    Regards,
    Al Lal
    Code:
    REPORT  YABHINAV16.
    program to display products at chosen level *
    Tables: T179, T179t.
    types:  begin of hierarchy,
            prodh type t179-prodh,
            vtext type t179t-vtext,
            stufe type t179-stufe,
            end of hierarchy.
    data: pvs type standard table of hierarchy initial size 0.
    select-options level for t179-stufe no intervals.
    Select prodh stufe from T179 into corresponding fields of table pvs where stufe in level.
    select vtext from t179t into corresponding fields of table pvs where prodh = pvs-prodh.
    sort pvs by prodh.

    Hi Just change the code accordingly...
    Tables: T179, T179t.
    types: begin of hierarchy,
    prodh type t179-prodh,
    vtext type t179t-vtext,
    stufe type t179-stufe,
    end of hierarchy.
    types: begin of text,
             prodh type t179t-prodh,
             vtext type  t179t-vtext,
             end fo text.
    data: pvs type standard table of hierarchy initial size 0.
    data: it_text type standard table of text,
            wa_text type text.
    select-options level for t179-stufe no intervals.
    start-of-selection.
    Select prodh stufe from T179 into corresponding fields of table pvs where stufe in level.
    select prodh vtext from t179t into corresponding fields of table text for all entries in pvs where prodh = pvs-prodh.
    end-of-selection.
    sort pvs by prodh.
    sort it_text by prodh.
    loop at pvs.
    read table it_text into wa_text with key prodh = pvs-prodh.
    if sy-subrc eq 0.
    pvs-vtext = wa_text-text.
    endif.
    modify pvs.
    endloop.
    Award Points If useful

Maybe you are looking for

  • Can i install the upgrade ilife11 on TWO computers?

    I bought the ilife 11 upgrade and installed it succesfully on my imac. Am I allowed to also install it in my macbook?

  • Saving a pdf to computer hard drive

    Someone sent me a pdf file.  I have only an adobe reader and no subscription.  How do I save it to my computer hard drive since when I click on the pdf file, it only allows me to save it to acrobat.com but I need to store it on my computer.

  • Drop Shadows using Type Tool

    Is there any way of changing the 'intensity' or 'angle' of drop shadows? I am of course using Layer Styles/drop shadow, but can the angle/intensity be changed. Thanks

  • How to quote while replying in this forum?

    Hi, i have some general question, while replying to the questions i haven't seen the quote option and wondering how you are quoting other replies. i have read the FAQs in this forum none of them specified how quote? Can some explain me how to quote?

  • Repaired permissions got a warning about a SUID file that's unrepairable?

    Repaired permissions om my Macbook  and got a warning immediately that ihave a SUID file "systems/library/core has been modified and will not be repaired. There is also a large question mark sign on my finder window---can anybody help me understand w