How to display the column single line with function of nested groups

SQL > select deptno, Max (sum (sal)) SalSum
2 of PEM
3 Group of deptno;
Select deptno, Max (sum (sal)) SalSum
*
ERROR on line 1:
ORA-00937: not a single group group function

Can you please help me to get the Max (sum (sal)) with Deptno...

Or:

select max(deptno) KEEP (DENSE_RANK LAST ORDER BY SalSum) deptno,
max(SalSum) from  (
  select deptno,sum(sal) SalSum
  from emp
  group by deptno
);

Tags: Database

Similar Questions

  • How to display the number of lines of time giving the values of the columns?

    Hi all

    I want to display the number of rows times the value exists in the column num in the query below


    with t AS
       ( SELECT 'venkatesh' NAME, 'hyd' LOC, 2 NUM FROM DUAL
         UNION ALL
         SELECT 'prasad' NAME, 'hyd' LOC, 3 NUM FROM DUAL
         UNION ALL
         SELECT 'krishna' NAME,     'hyd' LOC, 1 NUM FROM DUAL )
      SELECT T.* FROM T
      CONNECT BY ROWNUM <= NUM
    
    
    Expected output:
    
             venkatesh            hyd      2
             venkatesh            hyd        2
             prasad                 hyd        3
             prasad                   hyd      3
             prasad                   hyd      3
             krishna           hyd       1
    Published by: Nag Aswadhati on November 1, 2012 12:34

    Aswadhati NAG wrote:
    Hi all

    I want to display the number of rows times the value exists in the column num in the query below

    Expected output:
    
    venkatesh            hyd      2
    venkatesh            hyd        2
    prasad                 hyd        3
    prasad                   hyd      3
    prasad                   hyd      3
    krishna           hyd       1
    

    With the help of connection by: -.

    with t AS
       ( SELECT 'venkatesh' NAME, 'hyd' LOC, 2 NUM FROM DUAL
         UNION ALL
         SELECT 'prasad' NAME, 'hyd' LOC, 3 NUM FROM DUAL
         UNION ALL
         select 'krishna' name,     'hyd' loc, 1 num from dual )
      select t.name, t.loc
      from t
      connect by level <= num
             and name = prior name
             and (prior sys_guid() is not null);
    
    NAME      LOC
    --------- ---
    krishna   hyd
    prasad    hyd
    prasad    hyd
    prasad    hyd
    venkatesh hyd
    venkatesh hyd 
    
     6 rows selected
    
  • How to display the columns in the wise line in pl sql

    I have to display some values of constant wise online using the select statement. For example, after query both display constant columnwise...

    Select 83: 42 double;

    83 42

    I want to display the rowwise... IE

    Constant
    83
    42

    I can create temporary table and add them then ask, but there should be a way I can use double to show the values line wise. something like

    Select a double where an in (83, 42)

    Appreciate your help.

    Hello

    Here's one way:

    SELECT     column_value    AS cnstnt
    FROM     TABLE (sys.odcinumberlist (83, 42))
    ;
    

    CONSTANT is a keyword from Oracle is not a very good name for your own column.

  • How to display the first 5 rows with a specific filter

    Hi all
    Please take a look at the below mentioned query.
    select * from emp where empnm like 'B%';
    Now suppose that it will display 10 lines. But I want to display 5 rows out of them.
    How can I do? I tried with rownum and rowid. It worked because the files are in order,
    But if these records are arbitrary order, now what? What should be done here?


    Kind regards
    BS2012.

    ASO
    I changed my query, this is the correct way to refer, and you must provide the exact column based on which you assume documents are old or new, in descending order.

    Thank you!
    Ashutosh

  • BI Publisher - how to display the number of lines displayed at the bottom of the table on each page

    Hello

    We are the conversion reports Actuate BEEP and not able to understand how to view "Accum.Total = < n >" at the bottom of each page. In the attached report to operate it, "Accum.Total = < n >" must be displayed at the bottom of each page where < n > is the number of lines displayed on the current page and previous page.

    For example, if there are 10 rows in the result set, if the 1st page displays 4 rows, 2nd page displays 3 rows and 3rd page is 3 lines and then Accum.Total = 4 on page 1, Accum.Total = 7 on page 2 and Accum.Total = 10 on page 3.

    Note that we use the property table "allow the lines to break Pages = False" as we do not want a specific line can be split across pages.

    I enclose a sample of report actuate, rtf, BEEP and XML report for testing file.

    Approach used so far-

    1 > I tried to put the counter in the footer, but it seems that only the fields that come directly from the IC can be used on the header/footer. No matter what form text field or variables defined in the report.

    2 > I used approach given in the link below. Using this approach, I am able to view a coded value hard at the bottom of every page (just below the table) but his does not work for the variable (in my case the counter c1).

    https://blogs.oracle.com/xmlpublisher/entry/continued

    3 > on Google, I found a few articles on the page break conditionally as display only certain numbers on a page or the page by section break but in our case, its dynamics and its number of lines to display on a page is driven by data, so I could not think of a certain condition to use in "Condition." ": If" for use as a page break.

    Thank you

    Richa

    Watch see the-Report

    http://docs.Oracle.com/CD/E28280_01/bi.1111/e22254/create_rtf_tmpl.htm#do_bf_cf

    Download the https://blogs.oracle.com/xmlpublisher/entry/continued sample

    Add

    <>

    name = "contd_footer".

    format = "99G999G999" / >

    After the field "Footer."

    If need to use a footer to display the meter then and sous-modèle with code above and call it in footer

  • Display the columns as lines

    Hello

    I have these sample data:

    ID name salary Dept Manager Commission
    1Roger3000TechBobJanuary-1000
    1Roger3000TechBobFeb-2000
    1Roger3000TechBobMar-3000

    I need the output voltage:

    ID name salary Dept Manager Commission
    1Roger3000TechBobJanuary-1000; Feb-2000; Mar-3000

    Can you please help?

    Thanks in advance

    SELECT id, name, salary, dept, Manager, LISTAGG (commission, ';') Within the Commission (ORDER BY id) GROUP table

    GROUP BY id, name, salary, dept, Manager;

  • How to set the content of the column for lines of automatic separation

    Hello guys,.

    I have a problem with the column width and the content of column in a standard report. In the report are hugh entries that are not interrupted by a space character. I put my column width to a special value by usingen "style css: display block; Width: 300px; ». Now the problem is that some of the entries in the column with a longer width that the column width is set. Then they overlock the entries in the column next to them.

    My question is: How to set the column lines of automatic content break after a certain number of characters?

    After searching for a couple of websites and discussion thread, I found maybe a reference to the solution. I hope that it helps you to give me an answer.

    A4 FORMAT LAST_NAME COLUMN
    */*

    concerning

    wderr

    Wderr,

    It is more a matter of HTML as a matter of APEX... You can start by looking here:
    http://www.456bereastreet.com/archive/200704/how_to_prevent_html_tables_from_becoming_too_wide/

    Kind regards
    Dan

    Blog: http://DanielMcGhan.us/
    Work: http://SkillBuilders.com/

  • How can we do a single element with the content of two clips

    How can we do a single element with the content of two clips

    You try to get a picture of image? In other words, that contained two visible clips at the same time? If you are, change the substantive item to you main plot and another tie on top using an edit connect to the battery. Select the top item. Activate the transform tool and resize and reposition the clamp if necessary.

    Russ

  • How to display the comments column in Windows Media Player 12?

    WMP12 - how to display the comments column?

    I want to see the Cooments ColonneB in my WMP ads, but it is not giving me the option.

    Hello

    1. What do you mean exactly by the column comments?
    2. are you referring to in Windows Media Player?

    If you want to change the information contained in the Windows Media Player, you can follow the steps in this article.

    http://Windows.Microsoft.com/en-us/Windows7/add-or-edit-media-information-in-Windows-Media-Player

  • How to display the path of a contact with a program?

    How to display the path of a contact with a program?

    Hey,.

    Follow the mentioned below as follows:

    1. Go to Contacts > Contacts.
    2. Highlight the contact to which you want to see the way through the program.
    3. Click on the newspaper story > program activity.

    Thank you...

  • How to not display the column heading in the table view?

    I don't want to display the column header in the table display, how I can make?

    If you use JavaFX 8, you can use the following text in an external style sheet:

    .table-view .column-header-background {
      -fx-pref-height : 0 ;
    }
    

    If you use JavaFX 2.2, the - fx-pref-height attribute is not available in css, so I think that you must resort to a search:

    final Region tableHeader = (Region)table.lookup(".column-header-background");
        tableHeader.setPrefHeight(0);
    

    As always, I am obliged to point out that I don't really like the research. Sometimes, they seem to be the only way, however.

  • How to display the rownum in oracle forms?

    Hai all,

    How to display the rownum in oracle forms?

    Thank you
    RCS
    ----------------

    I would add rowum with the current form of group_mstr:

    former columns:

    group_id
    GroupName

    new columns will be:

    identifier of the line
    group_id
    GroupName


    I created as follows:
    in forms
    text tool > row id
    text element > EXT_ITEM20

    error text element: no white color, it's a different color
    --------------

    create > Trigger > a time new form instance > I gave like this:

    DECLARE
    CURSOR crrow_id IS
    SELECT count (*) + 1 group_mstr;
    BEGIN
    OPEN crrow_id.
    Search FOR crrow_id IN: TEXT_ITEM20;
    CLOSE Crrow_id;
    END;
    ------------
    error: identifier group_mst must be declard
    ============

    I don't know also not quite what you want to display in your form. Do you want to just number the records displayed, from 1 to n?

    If so, create a text whose property 'data base element' element to the value 'no', "calculation method" formula and the formula itself: SYSTEM. " TRIGGER_RECORD, then, in each case, the registration number should be indicated.

  • How to display the list of components in ultiboard 10?

    The DRC report the errors where the components that are no longer in the design have been removed. How to display the list component and then remove them from the netlist to stop this?

    Ultiboard reported missing errors of component (part 'X' is not about design) because the part is always referenced by a net. To fix this, you must remove the part of the net. Following the steps below to remove the part form the net.

    1 tools > Netlist Editor

    2. for each network that the part has been connected to, select the Net (upper-left).

    3. Select the tab of pine trees, select the part and it is the PIN in the dialog box, then click on remove

    The problem is when the part is removed, I see no easy way to determine the threads you need to remove the part of. I entered this as a feature request to make this easier, but as a workaround, you can put part and say Ultiboard what the missing part, then search the net names on the pins and remove the part of these pins

    1 place a piece with a lot of pine trees (for example the part that was removed, or for example through Hole technology > Connectors > SIL & headers > HEADER2X9). When you place the part, make sure that the RefDes matches the RefDes of the part which has been removed.

    2. once the room is placed, you should see rats nest lines that connect the part to the nets.

    3 Zoom on the pins. You should now see the net name on each of the axes. For each of the pins connected, remove it from the net as described above.

    4. remove the part that you placed.

  • Arrow line (single line with an arrowhead) in MS Paint Win7

    Is there anyway that I can draw an arrow line (straigt single line with an arrowhead at the end) in the new MS Paint in Win7?

    The following items may be worth a visit:

    Windows 7 - paint help
    http://Windows.Microsoft.com/en-us/Windows7/using-paint

    Windows 7 - getting started with paint - tutorial
    http://Windows.Microsoft.com/en-us/Windows7/getting-started-with-paint

    Windows 7 - How to add an arrow to a screenshot
    http://www.allsandiegocomputerrepair.com/693/how-to-add-an-arrow-to-a-screenshot/

  • How to display the time of growth of the autoextended oracle files?

    Hello

    How to display the time of growth of the autoextended oracle files?

    Hello

    1. do you have re - seen view data dictionary in the oracle documentation?

    DBA_DATA_FILES

    dba_free_space

    dba_Tablespaces

    -Regarding (updated)

    DBA_HIST_SEG_STAT

    DBA_HIST_SNAPSHOT

    DBA_TABLESPACE_USAGE_METRICS

    DBA_HIST_TBSPC_SPACE_USAGE

    2. If not, then re - discovers once and understand the use of columns and build the query.

    3. If Yes, then why you have not tried to build queries

    4. again, if you're lazy, search in google or forums. ton of translates queries

    5. What are the disadvantage of step 4 - you will not get to learn something (0% gain of knowledge).  If you really want to learn, then try to learn to build query, and try to understand the views of data dictionary

    6. When you spend above task at the end of the task you will get satistided with two things

    --> Understand how to use the Oracle docs for help and where to look in the future

    --> Your skills / knowledge gain - trust me it will make you another step to learn new things.

    7. If you don't know SQL, learn the basics takes hardly 2 to 3 hours and then you can build query.

    It may be useful

    -Pavan Kumar N

Maybe you are looking for

  • How to define which site comes back in a new tab?

    Since the installation of the latest version of Firefox, when I click on '+' to create a new tab, the Yahoo search site always comes to the top. I do not want the Web site. How can I change coming to the site?

  • Lenovo K920 video call

    IM using K920, my question is. HOW can I MAKE a VIDEO CALL from this phone? I check everywhere but still can't find the function

  • The inexplicable timeout message

    I get an inexplicable message box timed arise. In my user interface, I have a test form that contains the controls AppManager and ExecutionViewManager. In the FormClosing event handler, I make the following calls to VB.NET 2008: AppMgr.GetEngine.Term

  • Windows Update does not work with IE 8

    When I try to use windows update, I am directed to the error page tells me that in order to use windows update, I need to upgrade to a more recent than IE 5 web browser; Well, I use IE 8.

  • Dell Precision T7500 hangs at BIOS on reboot

    Hello My Dell Precision T7500 hangs after that screen "search for devices to HBA 0..." tells me that ROM is installed successfully. Thank for nothing. It just hangs. I tried to restart, open the SAS configuration - there only one option, tried the F1