Top 10 unit cost per part number of the seller

Hi all
We are runing Oracle 10 g. I would like to limit the result set for the query to only the top 10 most unit_cost. How can I achieve that? Affecting rownum < = 10 will retrieve incorrect result.

Here is the code:
select vendor_part_number,  sum(quantity), sum(unit_cost)
from PO_ITEM
group by VENDOR_PART_NUMBER
order by 3 desc
The result, I want to come back is as follows:
VENDOR_PART_NUMBER     SUM(QUANTITY)     SUM(UNIT_COST)
   146565                  272          3,138
   162052                  224          3,060
   126343                    260             2,682
   113886                  228          2,599
   39167                     156             2,027
   337981                  104             1,840
   55825                  116          1,803
   42983                     188             1,720
   34481                     204             1,647
   112318                    180             1,512
If I add WHRE ROWNUM < = 10, I get the following result is incorrect:
select vendor_part_number,  sum(quantity), sum(unit_cost)
from PO_ITEM
WHERE ROWNUM <= 10
group by VENDOR_PART_NUMBER
order by 3 desc
Note that not only the result is incorrect, but also only 6 rows are returned.
VENDOR_PART_NUMBER     SUM(QUANTITY)     SUM(UNIT_COST)
   201424                   20          81.79
   226457                    8          67.63
   241094                   20           58.2
   285195                      8          42.65
   289359                      4          35.89
   270302                       4          23.96
Thank you for your help,

Seyed

Will be in many ways. One is:

select * from (
  select vendor_part_number,  sum(quantity) sum_qty, sum(unit_cost) sum_cost
  from PO_ITEM
  group by VENDOR_PART_NUMBER
  order by sum_cost desc
)
WHERE ROWNUM <= 10

Where ROWNUM clauses must be AFTER the order by clause to work.

PS: advice on applications TOP - N is [url http://www.oracle-base.com/articles/misc/TopNQueries.php] here

Published by: Kim Berg Hansen Sep 28, 2011 16:34
Added by URL-Oracle-based PS

Tags: Database

Similar Questions

  • Satellite P300-1 has 8 - part number for the AC adapter / CC

    Hello.

    Can anyone tell me the part number of the AC adapter I need to buy for my Satellite P300-1 c 8?
    Model No.: PSPCOE-01H008EN 15550 / 1024/1024/160 G 54/17W + BT/D52/L/M/L

    The toshiba site list or recognize the model, CarPhone Warehouse does not provide me with detailed documents and the original adapter was stolen. If not, can anyone provide an email address for toshiba (I am unable to call during their office hours).

    Or failing that, some general tips on an adapter compatible Please, I bought an adapter for the correct base - 19V, 3 specification. 95 a, (75W), Connector (PA3715E-1ACE) 2.5/5.5mm however, it does not work. The toshiba site lists another card of the same specs (PA3468E-1AC3) but I am reluctant to risk without being sure that it is just to buy it. I'd be happy to buy a universal adapter but only a high quality which will not be an electrical danger.

    Thanks in advance for any help.
    Clare

    Hey Buddy,

    You can search for options and accessories here:
    http://EU.computers.Toshiba-Europe.com/innovation/generic/PC-options-Accessories-EU/

    Why you need an email at Toshiba?
    If you have questions about spare parts, you must contact a Toshiba instead authorized service provider.

    In general, I would recommend the original adapter because it of tested and designed for your laptop. With other words, it s a product of high quality.

  • Compaq 4000 Pro small form FAC.: part number for the Compaq 4000 Pro Small Form Factor Windows OS

    I am looking for the part number for the Windows 7 Professional SP1 reinstall the operating system on the desktop LTS Pro 4000.  I'm working on the reinstallation of the operating system on a computer group for a company that installs and got mixed albums and I can't match what disks go with what models.    Now, my problem is the Pro 4000.  I have a disk with the part number 650432-DN3, which says "for Distribution only with a new HP or Compaq PC.  32-bit software.  Is it possible to determine whether this is the right drive for this machine?

    TIA for any assistance.

    Hello:

    This disc is not specifically for this model.

    It's for a business laptop, but you should be able to use this disk on a desktop HP business or a laptop that came (or could have been) with windows 7 Pro.

    You must then install all the drivers you need for HP 4000 Pro support page.

    There is no need to enter a product key.

    The recovery disc for a Pro 4000 would be in a set of at least 3 and numbered accordingly.

    Also, it would be labeled HP Restore Plus.

  • Can you please provide me with the part number for the screen for model #: NX. SHKAA.001?

    Can you please provide me with the part number for the screen for model #: NX. SHKAA.001 (AO1 - 131 M-C1T4)?  The first ten digits of the serial number are NXSHKAA005.

    Matt or gloss is what it looks like. Some like not brilliant but because most are a reflection. I would say that they would work as long as the resolution of the size and the backlight are the same.

  • Search for the name and part number of the CPU or fan of radiator for Pavilion m9300t Desktop fan.

    Looking for a part number and the name of processor or fan for desktop computer HP Pavilion m9300t radiator fan. Noise one supplied with the PC is a terrible grinding until the system stops and dies.

    Hello

    I highly recommend not to turn on your computer until the fan is replaced.

    Is your PC still under warranty?

    You may not use the original part.

    All you need is to have a CPU for a socket 775 CPU fan (LGA775). I recommend that you choose 90-92mm fan size due to the limitations of the original business space.

    You will also need thermal interface (I recommend Arctic Silver 5 or OCZ Freeze Thermal Interface material)

    material can be purchased at any store for PC. You can also have the fan replaced in a PC shop little charges.

    The original p/n is 5188-5525 to the heat sink. Source reference: HP PartSurfer

  • Please - what is the part number for the Sata cable in the Dell XPS 15 skylake?

    Hello

    I just bought the 9550 with the GB 250 m2.   He came with the small battery and the cage for the standard Player 2.5 ".   To do this, it came not with a cable.   I can find the part number for the old cable SATA model but don't know if she's not the right connector or length.   If someone has bought the new model of skylake and tore your model to replace the drive of spindle, please let me know the part number of the cable.   I would like to order one, but Dell support didn't know the part number.

    Thank you

    The part is xdygx

  • Part number for the T400s left speaker grille?

    The grid on the left side of the keyboard on my T400s has fallen - and I can't find same what is the part of that number?

    45 2656 M which is the reference number of the entire scope of keyboard you need to get in order to get a new grille left speaker. (This includes other pieces as well, and I imagine you would cost a bit to get to replace)

    http://www-307.IBM.com/PC/support/site.WSS/MIGR-72793.html

    listed in the link above.

  • Re: Satellite R630-155 - part number for the LCD cover

    My 3 year old belle has hit my R630 on the floor and the plastic LCD casing/lid is now broken. Hinges are fine, the screen is fine - I just need to replace the plastic cover. How find the part number or get a new one?

    Thank you.

    Hey,.

    Here you can get t numbers because it s a forum for owners of Toshiba laptop only. If you can speak with normal people like you and me here.

    If you need these technical details such as part numbers, you will need to contact a service provider authorized in your country. Guys have access to databases of Toshiba and can give you the exact reference and order this part too.

    Good luck! :)

  • Part number for the serial port in option HP Z420

    I am looking for the serial port in option for the HP Workstation Z420, but in a datasheet, it is only mentioned as an optional serial port kit.

    What is the number on the right side of the product? The same for the workstation Z400 was PA716A, but it was not compatible with the new workstation model...

    I used the same part number, I used to model Z400 and it seems to work well.
    HP code is PA716A.

  • Satellite A210-16F - part number for the chassis need HARD drive

    Hello

    does anyone know what what is the * part number of hard drive for toshiba satellite A210-F16 chassis *.

    The model number is * PSAELE-01S009G3 *.
    I had a frame of HARD drive with a V00927210 part number that does not match this pattern.
    If anyone knows of a reference number or if it can display an image, at least, I would be very gratefull!

    Thank you!

    Hello

    I put t know what HARD drive chassis you re meaning precisely because the HARD drive in my A210 notebook can not find in any media
    It s just connected to the connectors in the HARD drive Bay.

    Anyway, if you need a few laptop parts (not looking at this as part it is) then I recommend you contact the ASP (certified partner) in your country in order to get a part for the Satellite A210 laptop model.

    See you soon

  • I can't find my "Hp Pavilion Dv6-6c50se" on PartSurfer product, I need my part number of the fan

    Hi, as I said in the topic I can not find my product...

    Pavilion Dv6-6c50se
    My S/N: [under the direction of personal information]
    my P/N: A7P18EA #ABV

    now what? I really need to change my Fan and I can't get the part number of this one...

    Help, please.

    Hello

    Here is the user manual to help you: http://h10032.www1.hp.com/ctg/Manual/c03099531.pdf

    Go through the Page 27, 83-87, the part number of HP for the cooling fan / heat sink (includes the thermal material replacement) is 665309-001.

    There's another piece on textbooks for her number: 665354-001, but I could not confirm through research engine search or shop online.

    I suggest that you go ahead with the order of the fan with the part number: 665309-001. The fan is delivered as a whole Assembly. You can get separated from you want to through online stores.

    Here are a few:

    http://m.eBay.com/ITM/HP-Pavilion-DV6-6000-dv7-6000-Fan-Heatsink-650797-001-641477-001-665309-001-/111086784282

    http://PartSurfer.HP.com/search.aspx?SearchText=665309-001

    http://www.Amazon.com/GP/AW/d/B00IWMO0TU?pc_redir=1405404997&robot_redir=1

    http://www.Amazon.com/GP/AW/d/B008H68ZI8?pc_redir=1405525908&robot_redir=1

    I hope this helps to solve the problem,

    Thank you

  • Parent part number of the Board of Directors of hp Mini 210

    Body aid like me to locate the part number of my computer hp mini 210.

    I opened the back cover, but you don't know where it is.

    See you soon,.

    Sylvain

    When you request support, please provide the number full name or product model of the HP computer in question. HP/Compaq made thousands of computer models. Without this information, it can be difficult, even impossible to help you solve your problem.

    The information requested above are at the bottom of your computer or inside the battery compartment. , Please do not include your serial number. Please enter the product/model information in the HP Online Support page for consumers , and/or post it here for our review.

    If you have any other questions, feel free to ask.

    Please click the White Star of KUDOS to show your appreciation

  • What is the part number on the paper for the printer laserjet 9050 dn entry unit

    RG5-5677 or RG-5681

    RG5-5681

  • Portege R700 - part number for the Hebrew keyboard

    Someone can help me with the part not for Portege R700 Hebrew keyboard or how can I found it?

    Thank you

    Hey Buddy,

    It of Nice that you ask here for help, but he s user in forum. I mean there's no one here a list with the exact reference numbers so I think you need to contact a service provider authorized in your country. Guys can tell you the exact number for this keyboard you want and order for you.

    You know the contact address of the nearest authorized service provider?

  • Need part number for the CD/DVD for Satelitte 1800-314

    You want to upgrade the CD player to a Satellite 1800-314 to a CD-RW/DVD unit. Can anyone provide please leave no.. Current unit is a TEAC CD-224th-BA.

    Hello

    You cannot use each disk on laptops. It is very important that the laptop supports the drive. Master/slave or parameters c - salt on the drives for laptops are fixed and it of not possible to change as on drives for desktop PC.

    As a result, you can buy a player that is compatible with the right settings. If the drive supports the wrong settings if the BIOS of the laptop does not recognize the drive.

    I do not found the compatible players, but sometimes the devices are placed in the user manual that must be installed on the laptop.

    But don t be mad ;) Taken in charge and compatible readers and all other devices, you can order from the Toshiba service partner in your country.
    Simply make a call to the guys and they should give you a detail on the compatible parts.

Maybe you are looking for

  • DVDAuthoriz

    I found this article in my list of connection points: DVDAuthoriz What is c? Is this bad?

  • 355 G2: password

    Enter the power on password administrator password - don't know system off code 60474922 Need code of the entry. Thank you

  • chages of resolution screen when opening itunes

    Everytime I open that i tunes my screen resolution changes to 8-bit can't seem to know why. I removed and reloaded I tunes.

  • DVD with pictures on them do not play

    for some reason any DVD with the photo is no longer dependent. No walk at all to show a DVD has been loaded or is playing.

  • DevCon.exe

    How to run devcon.exe to remove a usb device in win xp / 7