Equivalent to percentage n top of page

Hi all

I would like to know what is the equivalent of the n top percent in Oracle 11 g sql.

Here are my requirements:

I have to find top 20% sales stores contribute:

Store Sales Percetage
ABC200(200/380) * 100 = 52%
XYZ100(100/380) * 100 = 26%
PQR50(50/380) * 100 = 13%
Delalande20(20/380) * 100 = 5%
rrrr10(10/380) * 100 = 2%

In the example above I get only ABC store that this store alone contributes more than 20% higher

If I change the top 70% requirement, I get ABC and XYZ store.

Any help would be much appreciated.

Thank you

MC

Hello

You can do with analytic functions.

Since I don't have a test version of your table, I'll use the table scott.emp to illustrate

WITH got_totals AS

(

SELECT ename

sal

SUM (sal) over (ORDER BY sal DESC

RANGE BETWEEN UNBOUNDED PRECEDING

AND 1E-9 PREVIOUS - arbitrary small number

) AS running_total

SUM (sal) () AS grand_total

FROM scott.emp

)

SELECT ename

sal

OF got_totals

WHERE (running_total NVL

0

) / grand_total< .2    ="" --="" .2="" means="">

Sal of ORDER BY DESC

;

Avec.2 in the WHERE clause, which produces the following output

ENAME SAL GRAND_TOTAL RUNNING_TOTAL

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

KING 5000 29025

FORD 3000 29025 5000

3000 29025 5000 SCOTT

If you change the number in the en.1 WHERE clause, you will get only KING, given that the sal of the KING by itself represents more than 10% of the total general (29025).

.

I hope that answers your question.
If not, post a small example of data (CREATE TABLE and only relevant columns, INSERT statements) to your table and the query above, they are suitable for your table.

Specify where this query is to produce erroneous results and explain, using specific examples, how you get the right results from data provided in these places.
See the FAQ forum: https://forums.oracle.com/message/9362002#9362002

Tags: Database

Similar Questions

  • Why is ee another language sign on ogf top of page

    When I use Firefox, sometimes I'll see another language written at top of page. I don't know what language it is, but why do you believe that I have this

    Do you mean on the tab bar? It might be the problem with McAfee SiteAdvisor. Could you take a look at these previous discussions and see if it looks like it:

  • 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?

  • The top of page 1 1/4 inch has no answer whin you click on it. As in this page, sign in or register and other app does not work. in English

    The top of page 1 1/4 inch has no response when you click it. As in this page, sign in or register and other app does not work. in English

    This problem can be caused by that extended the Yahoo! toolbar or extension of Babylon also well down and covers the top of the browser window and therefore links and buttons in this part of the screen not clickable.

    Start Firefox in Firefox to solve the issues in Safe Mode to check if one of the extensions or if hardware acceleration is the cause of the problem (switch to the DEFAULT theme: Firefox/tools > Modules > appearance/themes).

  • Firefox does not leave my mouse click on the top of a web page, that he will not let the mouse of course recognise that linking and custom allow to click the links in the top of page 2 "of a web page

    If I'm looking at a Web page any and I move the cursor over a link at the top of page 2 "more or less of the page, it will not recognize that there is a link and I would click on the cursor remains as the arrow and move by hand to make me click and open the link

    The extension of the Yahoo! toolbar reported that causes this problem. Disable or uninstall this add-on.

       * https://support.mozilla.com/kb/Troubleshooting+extensions+and+themes
    
  • WVC54G cannot open the game to the top of page

    I had to exchange for dyndns sololink last week and one of my cameras worked well but suddenly exploded line one day after I changed the settings to dyndns. I tried everything to get there and decided to finally reset. ID of the camera appears in the window of 192.168.1.115 camera but I can't access the set to the top of page, I cannot ping or see in the rental of the router table. I tried reset long & short, but without success... of the suggestions or known service officers would be welcome.

    Thank you Browny

    I had the same thing happen to me.  Go to the WVC54G product support page, then select Version1.0.  Download the installer from here (even if you have version 1.1 I did).  Running as the Wizard instead of the one that is on the cd has worked for me.  Good luck.

  • My desk top of page shortcuts does not open in a full screen__

    My desk top of page shortcuts does not open in full screen

    No matter what shortcut you use to launch the window, right-click and select Properties. Under the 'Run' drop-down list, choose "expanded".

    If the window opens small, try the following:

    Take the corners of the window and drag it to the format full screen. Do not use to expand. Close all other windows first and this one last. Windows will remember the * last * screen size used the next time that you open the program.

    Bruce Hagen MS - MVP [Mail]

  • With the new cartridge is already installed, I can't retrieve the set to the top of page to complete the installation.

    Hello, I have Norton antivirus and apparently everything is installed correctly but when I click the icon on the desktop after a very short time, the message appears.  I have an Acer Aspire V3 windows 8.1 - 64 bit

    I am trying to solve this problem since last week.  No change at all.  (I uninstalled all the components of the front range of HP printers)  The printer I have is HP C6250 all-in-one.

    I followed all the steps in the HP website and a couple of nights, it seemed that everything was working, when I prayed me to turn on the printer, one of the color ink cartridges more than ink and I could not finish the job.  With the new cartridge is already installed, I can't retrieve the set to the top of page to complete the installation.

    I thank very you much.

    Unless you have installed the full software from HP support features, none of the options on the cartridges of ink or HP Diagnostics will work

    http://h10025.www1.HP.com/ewfrf/wc/softwareCategory?cc=us&LC=en&product=3308554

    And if you bought "compatible" ink cartridges and not genuine HP that you receive msgs error cartridge like the habit of these cartridges compatible function with the HP software

  • 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.

  • How to place a menu in a top-level page which only reflects this child pages pages?

    I need to create a menu for the child of the pages are detached from one of my top-level pages. Can anyone help please.

    It is not a setting that does it automatically, but you can change the menu 'manual' and manually enter page names and links.

  • Press top of page on mobile devices.

    I'm sure this is a stupid question, but how do I make my mobile versions of my site replied when I plug the top of my browser on an iPad or iPhone, and to achieve top/home? Any other website that I use has this option, but I can't find any documentation or other forum posts about this.

    Create a content, all text as 'Top' and apply then scroll to this content without value in the areas of management. This would set the content on the page, average while scrolling the page, that this object will stay in his position.

    With the anchor link that is placed on the head, now bottom way or any section, if you type this object, then it would scroll to the top of the page top of page.

    We can only define the function and the function on the page of the site not outside of it.

    So if you are referring to the browser section where the url of the site is open and type function on the browser itself should scroll to the top of the page, then you need to look out for a custom solution that you have to do for all the browsers supported on mobile devices.

    Thank you

    Sanjit

  • The top of page 2 appeared at the bottom of Page 1

    Top of page 2 is now appearing at the bottom of Page 1 and I can't seem to understand how to bring it to the appropriate page.  I searched on Google and he suggested starting point tool.  In order to better explain what is my problem... in Word (and the document has been created from a form; not a Word document) I would have used a page break.  Unable to find anything like that.

    Sorry for what a quesiton of novice.

    Yes even if they say that you can convert to a doessn can't word Document it keep the word line breaks and the line ends with a return.

    You must do some editting before you can reuse.

    Other applications (for Mac and can be the same for PC) who turns to the Office of the PDF document. I don ' know there if do it better:

    Nuance PDF Converter for Mac

    PDF2Office v6.0

    Solid PDF to Word

    Wondershare PDF Editor Pro

    They can do better.

    It would be actually better so have a backup to: text.

    This way when you open it in Word to automatically on formatting a Word Document if it was introduced, to a vacuum worrd Document.  You will always have to redo any design of forms.

  • Button background fill 'Linear - top of page' not showing after save.

    I made the appropriate changes to make these very 'cool' buttons with the bottom filled with gradient look called 'Linear at the top', but once I have save this form and open the PDF file, the color button is rather solid and gradient or «linear top of page»

    Any explanation?

    If you have made the changes for you're your background color of the button at design time, it should keep the changes no matter where you open.

    If you made changes to your background color of the button with a Script, then you may need adjust Save changes automatically.

    If your issue is not resolved, by changing the settings, you can publish the form on [email protected], so I can take a look...

    Thank you

    Srini

  • Does not start player BDP - BX58 Blu - ray * top of page menu screen more

    Sony unit works very well for about a year now.   Nothing has changed on this end - but - now when I turn on the drive blu - ray I see on HDTV: logo 1) Sony blu ray then) 2 wave horizontal blu and 3) a black screen.

    Instead of 3)-I use to get the * top of page menu * screen for slecting an dvd, browser, etc.

    I noticed that when the device is in step 3) connected to my ethernet (blue light on the power switch of the internet is fixed).    So, I guess that the DVD player is having trouble finding something on the Internet (?).

    At this point, I can't play any DVD - the screen remains black.

    The unit is connected to a SONY AV box.    What is strange, is that nothing has been changed (?)    The latest firmware changes have been installed more than 6 mos ago.

    Help, please.

    solved problem today ' hui - connected hdmi blu - ray box AV Player cable was loose in box AV.   cable just guaranteed and everything is back to normal.  Thank you all for taking a peek.

  • No top-level page were found.

    I have a fresh install of Coldfusion MX7 on a Fedora Core 4 machine. But I have problems because whenever I try to open a *.cfm file coldfusion returns an error that says: "No top level Page was found" even though the path to the file is correct. Any tips?

    The/opt/coldfusionmx7/logs/contains an error similar to the following:
    "Error", "jrpp-114", "10-19-06","11: 37:19","" file not found: index.cfm the specific sequence of files included or processed is: /home/ravigehlot/public_html/index.cfm ".

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

    File not found: index.cfm

    ------------------------------------------------------------------------------------------ ------------------
    Exceptions

    12:35:11.011 - coldfusion.runtime.TemplateNotFoundException - in: line-1
    File not found: index.cfm
    ------------------------------------------------------------------------------------------ ------------------

    CF_TEMPLATE_PATH=/home/ravigehlot/public_html/index.cfm
    PATH_TRANSLATED=/home/ravigehlot/public_html/index.cfm
    SCRIPT_NAME = / index.cfm
    Server_name = www.ravigehlot.net
    SERVER_SOFTWARE=Apache/2.0.54 (Fedora

    is the name of user cfmx7 have execute access to this directory:
    / home/ravigehlot/public_html /.
    and a read access to index.cfm?

    You will probably want to/home/ravigehlot/public_html/775 permissions and the permissions 664 index.cfm

Maybe you are looking for

  • Click on Firefox stopped opening tabs on mousewheel

    Browser worked perfectly, and then in the middle of the browsing session it would not react to mousewheel clicks that were able to open tabs previously. Doesn't seem to be a problem with the mouse, because I can still use it to do the same in chrome,

  • Could not install Hotkey Utility on Satellite A105-S2051

    I installed the Spanish version of Windows XP. But when I try to install the Hotkey utility, I get the message: TOSHIBA common Module could not be found that will put an end to this configuration. I can't find the "Toshiba ACPI common Modules for Win

  • iMac (27 inch, 5 retina k, end of 2015) startup problem

    I am currently using late 2015 5 k retina 27-inch iMac. My iMac doesn't always dΘmarre as expected. There will be a start-up chime, but the screen just remains completely black. It takes sometimes more than 5 minutes to start magically after freezing

  • scam call perhaps?

    I got a call from someone who claims to tell me that my computer Microsoft did not meet an update of firewall for the past few days and that they needed me to go my computer for them to get access so that they could update my security. my instinct to

  • Pavilion dv6 2170 clock problem after replacing the CMOS battery

    Hello world. Sorry for my bad likely English OK, so the problem started since I changed my laptop CMOS battery. and to be honest it wasn't whit any problem the clock when I replaced it but I if this may be the cause of another problem that later I fi