How to embed the top-N capacity?

Good, guys.  This is a mind-bender for you.  We will use a modified version of the EMP to the Oracle table.  Suppose we add a 'number' column named CONO.  In the table EMP revised, every company has many departments, and each Department has several wages.  The goal is to print the total wages by company.  The trick is to only to sum N top salaries of each Department.  Can anyone of you wizards crack this nut?

Thank you

Kim

PS: if possible, please try to use the "don't like".

Hi, Kim.

Justin query needs a GROUP BY clause. otherwise, he did what you asked:

SELECT cono

The SUM (sal) AS total_sal

DE)

SELECT cono, sal

, RANK () OVER (PARTITION BY cono, deptno)

Sal of ORDER BY DESC

) AS rnk

WCP

)

WHERE rnk<= 1  ="" --="" or="" any="" positive="">

GROUP BY cono

;

Output of your sample data:

CONO TOTAL_SAL

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

1 10850

6950 2

Get the Top 1 may be a special case; You can do more things with the MAX function efficeint.  Justin solution (such as modified in this message) works for any value of N-1 or higher.

Tags: Database

Similar Questions

  • How to make the top sites page appears when I open a new tab? Why have I not of "buttons" to pin a top site of the page tab?

    When I open a new tab, NO best sites don't show up... shows just a search engine box. I have Firefox 33.0. Why is there no 'pin' button when I opened a new page? How to make the top sites page appears when I open a new tab?

    Here is some additional information on the configuration of the new tab page:

    (1) in a new tab, type or paste Subject: config in the address bar and press ENTER. Click on the button promising to be careful.

    (2) in the search above the list box, type or paste newtab and make a pause so that the list is filtered

    (3) double-click the preference browser.newtab.url and enter your favorite page:

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

    Press Ctrl + t to open a new tab and check that it worked. Fixed?

    Some traps:

    If Firefox will not let you change this setting: you can have what is called SearchProtect on your system.

    Firefox if allows you to save your changes, but he doesn't know: one of your extensions may be the substitution of her. You can consult, disable and/or remove extensions on the addons page:

    "3-bar" menu button (or tools) > Add-ons > in the left column click on Extensions

    If the modification works during your session, but during the next startup is leads to: you could have a user.js file in your personal settings Firefox (your Firefox profile folder). This article describes how to track down and delete the file: How to fix preferences that will not save.

    A little luck?

  • How to move the top of the screen (active form)

    Hi all

    How to move the top of the screen (active form),

    Suppose I have 5 screens in the battery, I want to make the screen at the bottom of the stack as Active (top screen) without pushing and poping

    Of the display is a battery.  To move round on screens requires push and pop, as it would to move items in a stack.  Sorry, if you want to see the screen that currently is the bottom of the stack, then you either have everything that is above him, the pop or pop and push up.

    But here, we are talking about instances of the screen, not the specific screen class.  To understand the difference here is an example.

    I have two screens in my application, a list screen and a detail screen.  My application starts with the list screen.  The user selects an item (X) and displays details on the subject using the details screen.  While displaying the detail, the user decides that he wants to see a different list.  So, we start a new instance of the list screen, showing a different list.  Then, the user decides to view some details of one of the items on the list (Y) and if the application displays a new instance of the details screen.

    So now that the user has 4 screens on the display stack.  The top of the screen is a detail showing the item detail screen, the screen below is an example of the display of the list, the screen under that is another detail screen, showing the point X this time, and under that is a list screen.

    Does that help?

  • How to get the top users page?

    Hello

    How to build the top users page with which users are more recently logged_in to the application? Similar to the picture here

    at.bmp

    --

    Thank you.

    Venky_prs wrote:

    How to build the top users page with which users are more recently logged_in to the application? Similar to the picture here

    Create a report of region using a query like:

    select
        user_name
      , max(access_date) most_recent
    from
        apex_workspace_access_log l
    where
        authentication_result = 'AUTH_SUCCESS'
    and application_id = :app_id
    group by
      user_name
    

    Use of the ' 16 hours ago" number / Date Format MOST_RECENT column.

  • BACKFLIP: How to clean the top toolbar after download?

    After downloading several apps to my backflip, I now have an icon for each download at the top of my screen, how do I remove these?

    -

    Slide the bottom of the toolbar and clear notifications options should appear at the top.

  • How to calculate the top 100 in analytical report of obiee 11g?

    Hello

    I am creting report Analytics obiee 11g.

    I plug 5 columns, balance, status of the loan, district loantype.

    I want to display the data from the highest of 5 columns in the analytical report...

    For this report, I would like to add customized lines...

    My requiremt, I want to show the top 100 sales, the total amount outstanding

    and I want to add personal calculation as (total of balances / top 100 outstanding balance) * 100

    Please help me,

    I tried, I don't get.

    Please help me, how calculate these?...

    Thank you and best regards,

    A.Kavya

    Hello Kayva,

    First of all, must be defined, the grade you want, ask yourself, if you want to rank by period, branch etc, so you must use "RANK (according TO SIZE).

    I made a sample with the similar columns you use, please give.

    I've done 4 criteria using 'UNION' (not 'UNION ALL', not 'INTERSTECT', 'LESS'):

    And my results are:

    Check it out:

    1st test:-J' have the sum 187 157 538.57 as the sum of the top 10 projects, the Company (Empresa) and period (Mesanodocum)

    2dont criteria: -check the second line "SumaTotalProyectos" which is the sum total of society in Ene-2015 (January 2015) for all projects. Who is 211 249 318,42

    3 criteria:-check the 187 157 538.57 which is the sum of the top 10 projects

    4 criteria: -which is the percentage of it, 187 157 538.57 / 211 249 318,42 = 88.60%

    How can you put?

    1. allows you to check the criteria 1: the sum of the top 10 projects

    Check the filter of RANK

    2 to check the 2 criteria: total sum of society

    3 to check the 3 criteria: ranking of the sum

    4 to ensure criteria 4: percentage

    Note:

    As you can see I have two projects "columns", I need to get the sum of ranking, for example, you must do a ranking by branch and get the same, has twice this column to your criteria and after it allowed you to exclude.

    Kind regards

  • How to lock the top items on the page?

    Hello world

    I am a new user (in trial version) to Muse and despite the fact that I did the tutorial, I can't locked on the top of the page items where users scroll as in this page: Menu | Katie Bakery Café (Logo Katies + Menu and the second part also locked lunch/dinner...)

    Could you explain to me how can I do?

    I think the real problem is that I do not understand the difference between the top of the Page / header and the bottom of the page / footer...

    Could you explain that?

    Many thanks in advance and sorry for the misspelling: I'm just French

    Place an object where you want and PIN in this position by selecting its relative position in the band of higher order:

  • How we move the top point of the triangle down without shift 2 low points!

    Hello

    I'm doing my own logo... (trial and error)... and the need to move the top point of the triangle down without the 2 basis points on the way down!  Have been to him for a long time but the basis of 2 points to continue moving down for.

    It's actually a small square with a triangle roof - House, but the roof is too high.   Very simple things, but the basic points is still moving down!

    Would like to know how to do it!

    Thank you!

    Tania (U.K)

    If still in trouble, download a screen shot of your form with all points of view.  How did you produce the form?  You could either use the polygon tool with set on 3 sides, or a more convoluted process, is to use the pen tool to draw the shape.  Then with the resultant Workpath selected in the Trace Panel, go layer > fill new layer > solid color. This produces a new layer of the shape of your workpath.

  • How to align the top of the text leaves a field?

    How do I align text at the top left in a form field in Acrobat XI?  When I create a new text field, the text of the centres within the field.  Thanks for any help.

    Set the multiline (under Properties - Options tab) option for the text

    aligned at the top of the field. Horizontal alignment can be defined in the

    same situation in respect of the Alignment property.

  • How to remove the top bar of the Ipad

    Hello everyone

    I want to kow how to remove the bar that is located on the top of the screen of the Ipad and contains the signal status, clock and battery of WIfi. Is possible to remove this bar of any views on the app?

    PS. : I am usign a company of the DPS version

    Concerning

    This is part of the operating system. You can't do anything with it.

    Bob

  • How to disable the top menu in PDF.js Firefox PDF Viewsers

    I have the site to read documents online for users.

    I want to disable the top menu with ease to print, navigate through the pages, zoom, miniature etc..

    I want people to read the document online without allowing them to download or print document.

    Any idea?

    -Thank you

    Articles for Adobe Reader won't help for the built-in PDF Viewer.

    I guess you want to keep viewers save a copy of the file locally.

    You can't stop unless people can see this file in their browser.

    If Firefox displays the file then the file is already downloaded in the browser.

    They can always do a screenshot copy even with the hidden menu bar and use save the page, as if the URL in the address bar is the PDF file or, if there is a link to that file on a page, use Save Link as.

    If they disable the built-in PDF Viewer and that you use another Viewer rather then you don't have control over what they do with this file.

    You will need to use a plugin like Flash to view this content, possibly recover the file via a secure connection.

  • How to close the top of my T410 without going to hibernation?

    I have my laptop hooked to my big monitor and a regular keyboard T410 and do not need the laptop screen. I want to be able to close the laptop and put on the side so that I work and it has not automatically hibernate when I closed the top. Is this possible? Please provide the steps. I am somewhat tech savvy.

    Thank you!

    JR

    Yes, there is a setting in the power manager that indicate that the laptop should do when you close the lid. However, there is a potential problem with that - a build-up of heat.

    NAP.

  • Help do not know how to restore the top of my computer

    Sorry not to read and write about it

    I lost the top lines 2 ex: file, tools, Favorites, bookmarks, "back" button and also the open search bar right click on the top, but nothing came

    So I hope that someone out there could help me on this

    (Windows vista)

    Sorry not to read and write about it

    I lost the top lines 2 ex: file, tools, Favorites, bookmarks, "back" button and also the open search bar right click on the top, but nothing came

    So I hope that someone out there could help me on this

    (Windows vista)

    Using IE9 beta? If Yes...

    1. it has NO search box in top right more. The address bar doubles as a search box.

    2. the geniuses in Microsoft decided to hide the menu bar. Here is the tutorial to always show the Menu bar:
      http://www.SevenForums.com/tutorials/111483-Internet-Explorer-9-turn-menu-bar-always.html

    The link says Win7. Its ok. The method applies to Vista as well. I used on my IE9 beta.

    Use the Open Option - Download the .reg file and follow the simple instructions.

    For the benefits of others looking for answers, please mark as answer suggestion if it solves your problem.

  • How to check the top of the stack of the NavigationPane in QML page?

    Hello

    I have a NavigationPane and in a handler (a javascript function) connected to a slot to manage network responses, I want to blow the top of the stack. But only if she is still there because it might be close to the user using the button back on it.

    If I do just this:

    myNavPane.pop();
    

    and the top of the page has been closed by the user, this function causes a blank white page to appear on top.

    So I thought I could do something like this:

    if(myNavPane.top.id == "idOfSomePage")
        myNavPane.pop();
    

    But it does not work.

    Is there a way to do this?

    Thank you

    It works for me:

    If (nav.top.objectName is "myObjectName")

    {

    ...

    }

    And then just:

    Page

    {

    objectName: "myObjectName."

    }

  • Question how to freeze the top of the table line

    I try to freeze the top of a table row, so when you scroll the top line is fixed.

    I tried to use a CSS Style sheet and the link to the table. I can get the top row to freeze but the columns align not when you scroll the page.

    Thanks if anyone can help. It is my coding...

    < id of the table = "name of width ="1135"border ="2"align ="center"cellspacing ="2">"

    < thead style = "" >

    < b >

    < th = width "306" bgcolor = "#B7383A" style = "color: rgba (247,238,238,1)" > < h3 > < style strong = "color: rgba (248,240,241,1)" > < facilities > data < / h3 > < /th >

    < th = width "62" bgcolor = "#B7383A" style = "color: rgba (247,238,238,1)" > < AA h3 > < / h3 > < /th >

    < th = width "76" bgcolor = "#B7383A" style = "color: rgba (247,238,238,1)" > < SSAA h3 > < / h3 > < /th >

    < width th = "111" bgcolor = "#B7383A" style = "color: rgba (247,238,238,1)" > < strong data > < / strong > < /th >

    < width th = "111" bgcolor = "#B7383A" style = "color: rgba (247,238,238,1)" > < data h3 > < / h3 > < /th >

    < width th = "63" bgcolor = "#B7383A" style = "color: rgba (247,238,238,1)" > < data h3 > < / h3 > < /th >

    < width th = "44" bgcolor = "#B7383A" style = "color: rgba (247,238,238,1)" > < data h3 > < / h3 > < /th >

    < width th = "43" bgcolor = "#B7383A" style = "color: rgba (247,238,238,1)" > < EC h3 > < / h3 > < /th >

    < th = width "60" bgcolor = "#B7383A" style = "color: rgba (247,238,238,1)" > < h3 > < strong data > < / strong > < / h3 > < /th >

    < th = width "37" bgcolor = "#B7383A" style = "color: rgba (247,238,238,1)" > < data h3 > < / h3 > < /th >

    < th = width "60" bgcolor = "#B7383A" style = "color: rgba (247,238,238,1)" > < data h3 > < / h3 > < /th >

    < th = width "107" bgcolor = "#B7383A" style = "color: rgba (247,238,238,1)" > < data h3 > < / strong > < / h3 > < /th >

    < /tr >

    < / thead >

    link to stylesheet to table

    @charset "utf-8";

    / * CSS document * /.

    / * Table Styles * /.

    table #name

    {

    border: 3px solid black

    }

    Th {}

    }

    border-collapse: collapse {;}

    border-spacing: 1;

    }

    Table #name th, table #vigor td {text-align: center}

    table thead {} #vigor

    line-height: 12px;

    text-transform: uppercase;

    position: fixed;

    padding: 0px

    }

    table thead th {} #name

    padding: 0px

    }

    If you could please help, I would appreciate...

    There is a trick to this:

    Fixed the Table header - http://alt-web.com/

    Nancy O.

Maybe you are looking for

  • There is a Belgian version of Firefox?

    Check "Laatste nieuws" (latest news), I discovered that he only has an interest to people living in the Netherlands. Living in Belgium, can I get access to the Belgian news?

  • Cannot restart after the update of XP last night (08/13/09)

    Power the computer off last night, he said "stop after installing updates", so I just left the office.Is here this morning, the computer will not re-start in safe mode or safe mode with command prompt.I get the "Sorry for the inconvenience" screenA r

  • USB ports sporadically work / don't work on Dell Vista

    Sometimes I power up my external hard drive and the PC will behave as if nothing has changed.  The drive does not appear in the lists in the Manager of devices or my computer.  In this case no other connected devices does not work either.  I tried al

  • Error33 of Vista, there may be a download to fix the sidebyside

    displayed as a fix in Win7... vcredist_86.exe, but will it work on Vista Hm Prem?  If Yes, where is the download and how to get them?

  • Support custom T410 for Intel MyFi

    I have a T410 I ordered custom, and it is not the latest technology Intel MyFi.  Is it possible to update this product (for example with an accessory) so that it will support this technology? My product ID is 2516CTO and the serial number is xxxxxxxx