Display a salary Total of the Organization as well as the details of the employee in a line

Hi all

Salary Total of display of the Organization as well as the details of the employee in an example line below gives me all the lines of "total_sal" 29025

Select a.empno, a.ename, a.deptno, a.sal, b.total_sal

of the emp.

(select sum (sal) total_sal from emp b) b

Thank you

Display a salary Total of the Organization as well as the details of the employee in a ro

Display a salary Total of the Organization as well as the details of the employee in a line

Your condition is not clear. Can you show your expected results. Will this make?

SQL > select empno
2, decode (grp_id, 0, ename, 2, 'Total Department-' | to_char (deptno), 3, "Grand Total") ename
3, sal
4 of)
5. Select empno
6, ename
7, deptno
8, sum (sal) sal
9                 , (
10 grouping_id (deptno)
11 + grouping_id (empno)
12 + grouping_id (ename)
(13) grp_id
14 of PEM
Group 15
16 per cumulative (deptno, ename, empno)
17         )
18 where grp_id (0, 2, 3);

EMPNO, ENAME SAL

---------- -------------------- ----------

7782 CLARK 12450

7839 KING 5000

Total Department - 10 17450

7369 SMITH 12975

7566 JONES 12975

7788 SCOTT 13000

7876 ADAMS 11101

Total Department - 20 50051

7499 ALLEN 11600

7521 WARD 11250

7654 MARTIN 11250

7698 BLAKE 12850

7844 TURNER 11500

Total Department - 30 58450

Grand Total 125951

15 selected lines.

Tags: Database

Similar Questions

  • Query to display data with total

    Hi team,

    I have the whee requirement I need to display data with total and the total general.

    Examples of data include:

    with t as 
    (select 'chris' nm , 10 no ,'FT' Emplmt, 'PF' ProFund , 'Reg' Status ,to_Date ('05/02/2014','mm/dd/yyyy') dt , 2456 sal, 10 days , 50 intrst ,55 intrs1 ,60 intrs2 from dual
    union all
    select 'chris' nm , 10 no ,'FT' Emplmt, 'PF' ProFund , 'Reg' Status ,to_Date ('06/10/2014','mm/dd/yyyy') dt , 1000 sal, 30 days , 50 intrst ,55 intrs1 ,60 intrs2 from dual
    union all
    select 'chris' nm , 10 no ,'FT' Emplmt, 'PF' ProFund , 'NonReg' Status ,to_Date ('06/10/2014','mm/dd/yyyy') dt , 20 sal, -5 days , 1 intrst ,1 intrs1 ,1 intrs2 from dual
    union all
    select 'john' nm , 11 no ,'PT' Emplmt, 'PF' ProFund , 'Reg' Status ,to_Date ('05/02/2014','mm/dd/yyyy') dt , 1153 sal, 10 days , 50 intrst ,55 intrs1 ,60 intrs2 from dual
    union all
    select 'john' nm , 11 no ,'PT' Emplmt, 'PF' ProFund , 'Reg' Status ,to_Date ('05/16/2014','mm/dd/yyyy') dt , 1000 sal, 8 days , 40 intrst ,45 intrs1 ,50 intrs2 from dual
    )
    select * from t 
    

    Need the output like below format

    Chris FT 10 PF Reg 02/05/2014 2456 10 50 55 60

    Chris FT 10 Reg 10/06/2014 1000 PF 30 50 55 60

    Chris 10 FT PF NonReg 10/06/2014 20 - 5 1 1 1

    5456 35 101 111 121 subtotal

    John PT PF Reg 02/05/2014 1153 11 10 50 55 60

    John PT Reg 16/05/2014 1000 PF 11 8 40 45 50

    2153 18 90 100 110 subtotal

    7609 total 53 191 211 231

    Could you please give some thought to get the result as above.

    Thank you!

    something like this:

    with t as (select "chris" nm, 10 no, "Pi" Emplmt, "PF" ProFund "Reg" Status, to_Date (May 2, 2014 "," mm/dd/yyyy") dt, 2456 sal, 10 days, 50 intrst, intrs1 55 intrs2 60 double)

    Union of all the

    Select "chris" nm, 10 no, "Pi" Emplmt, "PF" ProFund "Reg" Status, to_Date (June 10, 2014 "," mm/dd/yyyy") dt, intrst 50, intrs1 55, 1000 sal, 30 days, 60 intrs2 of the double

    Union of all the

    Select "chris" nm, 10 no, "Pi" Emplmt, ProFund "PF", "NonReg" State, to_Date (June 10, 2014 "," mm/dd/yyyy") dt, 20 sal,-5 days, 1 intrst, 1 intrs1, 1 intrs2 of the double

    Union of all the

    Select "Jean" nm, 11 no, "PT" Emplmt, "PF" ProFund "Reg" Status, to_Date (May 2, 2014 "," mm/dd/yyyy") dt, 1153 sal, 10 days, 50 intrst, intrs1 55 intrs2 60 double

    Union of all the

    Select "Jean" nm, 11 no, "PT" Emplmt, "PF" ProFund "Reg" Status, to_Date (16 may 2014 "," mm/dd/yyyy") dt, 1000 sal, 8 days, intrst 40, 45 intrs1, 50 intrs2 of the double

    )

    SELECT decode (REUNION (nm), 1, 'Total', decode (grouping (State), 1, "partial": nm, nm)) nm

    , no, emplmt, profund, status, dt, sum (sal), sum (days), sum (intrst), sum (intrs1), sum (intrs2)

    T

    Rollup Group (nm, (no, emplmt, profund, status, dt));

    HTH

  • How to make calculations on the grid... salary total and so on?

    Hi Experts,

    I use the Employee table and I it shows as a grid in the jspx page.

    When I add or change the value of the SALARY column, the total salary of the employees in the grid should be updated in the State of the panelcollection...

    I just tried to use ValueChangeListener and I am an iteration values and adding the wage and doing other things...

    Is it an effective way to do this...?


    Please suggest some ideas...


    Kind regards
    GOPs

    Hello

    I guess you can also use groovy

    See page 12 of this link. Might be useful
    http://www.Oracle.com/technetwork/developer-tools/jdev/introduction-to-Groovy-128837.PDF

    Kind regards
    Briant

  • How to display the information in the employee table based on the salary in different ranges.

    I have a table that is used with the details of the employee. I want that employees on the basis of the order of the salary range for the list. For eg., list of employees that are there, I first list salary range 1000-3000 and 3000-5000, then 5000-10000. How to write sql queries to solve this problem? your answers are appreciated.

    something like that

    select t.*,
          case
            when sal between 1000 and  3000 then 1
            when sal between 3000 and  5000 then 2
            when sal between 5000 and 10000 then 3
            else 99
          end range
      from scott.emp t
      order by range, 1, 2;
    
  • In the menu Organizer media pictures will not display. When I import the photos are displayed until I try to display another file and then they are gone?

    I'm lost... I have recently updated to 12 PSE and my files all show them imported but I can't display pictures.

    Click the view menu and make sure you have all types of media choose to display.

  • Display screen is totally blank on my Tecra S1

    My TECRA S1 laptop display screen is totally blank, I can hear the windows startup and can connect an external monitor to the laptop and get a perfect display, but the computer screen is totally blank, can anyone help? Thank you!

    Hello

    If you have no problem with the external monitor it says it takes to display a malfunction.

    On this way, we can only speculate, but I assume that the display needs to be replaced.

  • I added third monitor display windows on it but the mouse is not going on the third screen

    I added third monitor display windows on it but the mouse is not going on the third screen

    Hello

    1. what operating system is installed on the computer?

    2. What is the brand and model of the computer?

    3. does the problem occur when you are working on a particular application?

    We will define the third monitor as primary monitor and check the functionality of the mouse.

    Link:

    http://www.Microsoft.com/athome/organization/twomonitors.aspx#fBid=XT_Tjm0Ldrb

    Please return to the State of the question.

  • How to only the totals using the native summary column (= "SUM () function

    Hi all, this is my data model:

    < name of dataTemplate 'Employees' description = 'Simple Dept - Emp' = >
    < dataQuery >
    < SQLStatement instance name = "Q1" >
    <! [CDATA]
    Select SERVICES. DEPTNO as DEPTNO,
    DEPARTMENTS. DNAME as a DNAME
    Scott. MINISTRIES DEPT order by DEPTNO]] >
    < / sqlStatement >
    < SQLStatement instance name = "Q2" >
    <! [CDATA [Select
    EMPLOYEES. ENAME like EMP_NAME,
    EMPLOYEES. EMPNO as EMPNO,
    EMPLOYEES. Hiring as HIREDATE date,
    EMPLOYEES. SAL as WAGES,
    EMPLOYEES. DEPTNO as EMP_DEPTNO
    Scott. EMPLOYEES OF THE EMP
    where EMPLOYED. [[DEPTNO =: DEPTNO]] >
    < / sqlStatement >
    < / dataQuery >
    < dataStructure >
    < name of group = "G_DEPT" source = "Q1" >
    < element name = "DEPTNO" value = "DEPTNO" / >
    < element name = "DNAME" value = "DNAME" / >
    < element name = "TOTAL_EMPS" value = "G_EMP. EMPNO"function ="COUNT ()"/ >
    < element name = "TOTAL_SALARY" value = "G_EMP. SALARY"function ="SUM ()"/ >
    < element name = "AVG_SALARY" value = "G_EMP. SALARY"function ="AVG ()"/ >
    < element name = "MAX_SALARY' value = 'G_EMP. SALARY"function ="MAX ()"/ >
    < element name = "MIN_SALARY" value = "G_EMP. SALARY"function ="MIN ()"/ >
    < name of group = "G_EMP" source = "Q2" >
    < feature name = 'EMPNO' value = 'EMPNO' / >
    < element name = "EMP_NAME" value = "EMP_NAME" / >
    < element name = "HIREDATE" value = "HIREDATE" / >
    < element name = "SALARY" value = "SALARY" / >
    < / Group >
    < / Group >
    < / dataStructure >
    < / dataTemplate >

    This datatemplate works very well with the TOTAL_EMPS, TOTAL_SALARY, AVG_SALARY, MAX_SALARY MIN_SALARY split for all departments; So these are subtotals.

    Now, I need to have the totals at the end of my report to the following:

    TOTAL_ALL_EMPS
    TOTAL_ALL_SALARY
    TOTAL_ALL_AVG_SALARY
    TOTAL_ALL_MAX_SALARY
    TOTAL_ALL_MIN_SALARY

    Add a new query (Q1) with all the totals, now the data model is the following:

    < name of dataTemplate 'Employees' description = 'Simple Dept - Emp' = >
    < dataQuery >
    < SQLStatement instance name = "Q1" >
    <! [CDATA]
    Select COUNT (empno) TOTAL_ALL_EMPS, SUM (sal) TOTAL_ALL_SALARY, AVG (sal) TOTAL_ALL_AVG_SALARY, MAX (sal) TOTAL_ALL_MAX_SALARY MIN (sal) scott TOTAL_ALL_MIN_SALARY. EMPLOYEES EMP]] >
    < / sqlStatement >
    < SQLStatement instance name = "Q2" >
    <! [CDATA]
    Select SERVICES. DEPTNO as DEPTNO,
    DEPARTMENTS. DNAME as a DNAME
    Scott. MINISTRIES DEPT order by DEPTNO]] >
    < / sqlStatement >
    < SQLStatement instance name = "Q3" >
    <! [CDATA [Select
    EMPLOYEES. ENAME like EMP_NAME,
    EMPLOYEES. EMPNO as EMPNO,
    EMPLOYEES. Hiring as HIREDATE date,
    EMPLOYEES. SAL as WAGES,
    EMPLOYEES. DEPTNO as EMP_DEPTNO
    Scott. EMPLOYEES OF THE EMP
    where EMPLOYED. [[DEPTNO =: DEPTNO]] >
    < / sqlStatement >
    < / dataQuery >
    < dataStructure >
    < name of group = "G_TOT" source = "Q1" >
    < element name = "TOTAL_ALL_EMPS" value = "TOTAL_ALL_EMPS" / >
    < element name = "TOTAL_ALL_SALARY" value = "TOTAL_ALL_SALARY" / >
    < element name = "TOTAL_ALL_AVG_SALARY" value = "TOTAL_ALL_AVG_SALARY" / >
    < element name = "TOTAL_ALL_MAX_SALARY" value = "TOTAL_ALL_MAX_SALARY" / >
    < element name = "TOTAL_ALL_MIN_SALARY" value = "TOTAL_ALL_MIN_SALARY" / >
    < / Group >
    < name of group = "G_DEPT" source = "Q2" >
    < element name = "DEPTNO" value = "DEPTNO" / >
    < element name = "DNAME" value = "DNAME" / >
    < element name = "TOTAL_EMPS" value = "G_EMP. EMPNO"function ="COUNT ()"/ >
    < element name = "TOTAL_SALARY" value = "G_EMP. SALARY"function ="SUM ()"/ >
    < element name = "AVG_SALARY" value = "G_EMP. SALARY"function ="AVG ()"/ >
    < element name = "MAX_SALARY' value = 'G_EMP. SALARY"function ="MAX ()"/ >
    < element name = "MIN_SALARY" value = "G_EMP. SALARY"function ="MIN ()"/ >
    < name of group = "G_EMP" source = "Q3" >
    < feature name = 'EMPNO' value = 'EMPNO' / >
    < element name = "EMP_NAME" value = "EMP_NAME" / >
    < element name = "HIREDATE" value = "HIREDATE" / >
    < element name = "SALARY" value = "SALARY" / >
    < / Group >
    < / Group >
    < / dataStructure >
    < / dataTemplate >

    It works fine, but my question is this:

    How can I change the data model and use the native summary column (function = "SUM (), for example) to collect data that I mentioned above (TOTAL_ALL_EMPS, TOTAL_ALL_SALARY, etc.), in order to avoid a third query SQL (Q1)?
    In a few words, I would only use the query Q2 and Q3 and have overall totals and subtotals.

    Thanks in advance for any help

    Alex




    Select 1 double DUMMY_FIELD]] >


    Select SERVICES. DEPTNO as DEPTNO,
    DEPARTMENTS. DNAME as a DNAME
    Scott. MINISTRIES DEPT order by DEPTNO]] >


    EMPLOYEES. ENAME like EMP_NAME,
    EMPLOYEES. EMPNO as EMPNO,
    EMPLOYEES. Hiring as HIREDATE date,
    EMPLOYEES. SAL as WAGES,
    EMPLOYEES. DEPTNO as EMP_DEPTNO
    Scott. EMPLOYEES OF THE EMP
    where EMPLOYED. [[DEPTNO =: DEPTNO]] >






















    Try this

    Concerning
    Charlotte

  • display of salary

    Dear all,

    You want to display the name of the employee and the amount of the wage in astericks.
    Each asterisk means a thousand dollars.
    for example

    Name salary
    ------------------------
    Charles Higgins *.

    Try this:

    create table test (name varchar2 (30), number (10,2)) salary

    Insert test values ('Karl Higgins' 12600);

    Select name. LPAD (' ', round(salary/1000,0) + 1,'* ') of the test;

    You can replace the round() ceil() function or floor depending on your needs. '+ 1' is to compensate the space used in lpad().

  • Thunderbolt Display 27-inch TV using the HDMI port Minidisplay

    My setup is macbook air, Thunderbolt Display, 55 inch TV.

    Wanted to know if I plug Thunderbolt display on TV through HDMI Adapter Mini DisplayPort / (Thunderbolt), it will be able to display of Macbook Air, Thunderbolt display and TV even time?

    Thank you.

    The Thunderbolt ports and displays: frequently asked questions (FAQ) - Apple Support

    An alternative would be to buy an Apple TV, then use AirPlay on your Mac to stream content both Thunderbolt display, Mac and TV, but the TV must be HDTV.

  • How can I disable the newtab most used feature display sites. I want the new tab to open the page displayed in the newtab:url in the topic: function config

    How can I disable the newtab most used feature display sites. I want the new tab to open the page displayed in the newtab:url in the topic: function config

    41 of Firefox is no longer uses the browser.newtab.url setting in about: config because he was constantly attacked by malware. From 41 of Firefox, you need an add-on to change the new tab page.

    Here are a few options (I'm learning more all the time):

    • If you are already using the extension classic restaurateur theme: There is an option somewhere (!) in his dialogues of the parameters to select another page in the new tab.

    Setting up substitute again tab

    After installing this extension, you must use the Options page to set the new desired tab page (instead of use subject: config).

    Open the page modules using either:

    • CTRL + SHIFT + a (Mac: Cmd + shift + a)
    • "3-bar" menu button (or tools) > Add-ons

    In the left column, click Extensions. Then on the side right, find the new tab override and click the Options button. (See first screenshot attached).

    Depending on the size of your screen, you may need to scroll down to enter the address in the form. (See second screenshot attached). For example:

    • (Default) page thumbnails = > subject: newtab
    • Blank tab = > subject: empty
    • Built-in Firefox homepage = > topic: welcome
    • Any other page = > full URL of the page

    Then tab or click this form field and you can test using Ctrl + t.

    Success?

    Once you have set it as you wish, you can close the Add-ons page (or use the back button to return to the list of Extensions of this Options page).

  • Displays no text entered in the address bar

    I am running Windows 7, and today I updated to version 40.0.2 of Firefox and then encountered the following problem.

    Text I entered in the browser's address bar does not appear, or appear irregularly, as by displaying only after that I get a certain number of characters.

    For example, just as I type "www.aninterestingurl.com" in the address bar. Nothing actually appears immediately, even if the cursor is visible to the right. And if I select the text by highlighting, then the text will be displayed.

    Please see the attached screenshot for a demonstration.

    You can try to disable hardware acceleration in Firefox.

    • Tools > Options > advanced > General > Browsing: "use hardware acceleration when available.

    You will need to close and restart Firefox after enabling/disabling this setting.

    You can check if there is an update for your display driver graphic card and search for hardware acceleration of related issues.

  • Windows 10. installed iTunes version 12.4.0.119. I have several iTunes libraries. On most of them display-&gt; ' display as ' does not show the grid option. A library of fact.  It's all music, with no video media. By default seems to be a list that is unc

    Windows 10. installed iTunes version 12.4.0.119. I have several iTunes libraries. On most of them display-> ' display as ' does not show the grid option. A library of fact.  It's all music, with no video media. By default seems to be a list that is unchangeable.

    Select the sidebar if hidden. View options > view as may depend on which of the options for the song, artist, album, etc. are selected in the sidebar.

    TT2

  • pop-up menu displays a small copy of the page

    pop-up menu displays a small copy of the page

    screenshot: https://drive.google.com/file/d/0B0WFSu8N2MiEVWZZajZxeDVUcXc/edit?usp=sharing

    Hello

    Try Firefox Safe mode to see if the problem goes away. Safe mode is a troubleshooting mode, which disables most of the modules.

    (If you use it, switch to the default theme).

    • Under Windows, you can open Firefox 4.0 + in Safe Mode holding the key SHIFT key when you open the desktop Firefox or shortcut in the start menu.
    • On Mac, you can open Firefox 4.0 + in Safe Mode holding the key option key when starting Firefox.
    • Under Linux, you can open Firefox 4.0 + with leaving Firefox then go to your Terminal and running Safe Mode: firefox-safe-mode (you may need to specify the installation path of Firefox for example/usr/lib/firefox)
    • Or open the Help menu and click on the restart with the disabled... modules menu item while Firefox is running.

    Once you get the pop-up, simply select "" boot mode safe. "

    If the issue is not present in Firefox Safe Mode, your problem is probably caused by an extension, and you need to understand that one. To do this, please follow article Troubleshooting extensions, themes and problems of hardware acceleration to resolve common Firefox problems .

    To exit safe mode of Firefox, simply close Firefox and wait a few seconds before you open Firefox for normal use again.

    When find you what is causing your problems, please let us know. It might help others who have the same problem.

    Thank you.

  • My Mac Book Pro iTunes no longer displays my playlists and under the songs I see that previously downloaded MP3 songs not many who were previously in iTunes and part of my playlists. .

    My Mac Book Pro iTunes no longer displays my playlists and under the songs I see that previously downloaded MP3 songs not many who were previously in iTunes and part of my playlists. .

    Turingtest2 CSA user help document: empty/corrupted iTunes after upgrade/crash library - https://discussions.apple.com/docs/DOC-6561

    If you do not see your content after updating to iTunes - https://support.apple.com/kb/HT203225

Maybe you are looking for