Retrive top five records

how we can select top five records of sal column from emp table.

http://forums.oracle.com/forums/ann.jspa?annID=599
PL/SQL

Similar Messages

  • How  to top five minutes and ten minutes record

    Hi,
    i have to get top five minutes records
    group by hostid and cpuid and timestamp is the field
    group by
    hostid,cpuid
    and the group is also based on last 5 minutes or ten minutes or one day
    select wait, idle, users, system ,wait+idle+users+system totalusers
    from (select hostid,cpuid, avg(wait_to) wait, avg(idle) idle, avg(users) users, avg(system) system from system_cpu where hostid='DSCP02469' and cpuid='first'
    group by cpuid,hostid having
    max(timestamp)-timestamp<5/1440))
    please correct it and send
    with regards
    shannu sarma
    Message was edited by:
    user517983
    Message was edited by:
    user517983

    Hi,
    SELECT uo.hostid,uo.cpuid,uo.timestamp FROM system_cpu uo
    WHERE timestamp >= (SELECT MAX(timestamp)
    FROM syStem_cpu uo2 WHERE uo2.cpuid ='cpu1' and uo2.hostid='DSCP02469') - (5 / (24 * 60))HOSTID CPUID
    and i even trying in this way but i am not getting right results
    hostid='DSCP02469' and cpuid='first'
    but other result are also comming due to
    som bad sub query.
    select cpuid,hostid,timestamp from system_cpu sys where
    exists (select hostid,cpuid from system_cpu
    where hostid='DSCP02469' and cpuid='first'
    having max(timestamp)-sys.timestamp<5/1440
    group by hostid,cpuid)
    SQL> /
    CPUID HOSTID TIMESTAMP
    first DSCP02469 29:jun:2006:18:33:01
    second dscp02469 29:jun:2006:18:30:18
    second dscp02469 29:jun:2006:18:31:04
    second dscp02469 29:jun:2006:18:32:53
    second dsc02469 29:jun:2006:18:37:36
    second dscp02469 29:jun:2006:18:40:39
    second dscp02469 29:jun:2006:18:41:26
    second dscp02469 29:jun:2006:18:42:31
    Message was edited by:
    user517983
    Message was edited by:
    user517983

  • Selecting top five rows

    hi,
    pls I have this issue that needs to be resolved. I need to select top five rows from a table depending on the values of a column stock_value. pls I will appreciate if someone can help me out, Francois pls try and help
    This is the senerio:
    I have a table stock, on the table I have company_name, stock_value, sector.
    Now I want to get top five rows from this table depending on the five highest value of stock_value and for each sector.
    lets try and write a query that will retrive the records after that I will put it in a procedure.
    I know am suppose to ask this on mssql forum but most mssql forums takes time to reply and this is very urgent cos I have to deliver in 45 minutes time
    thank you very much
    jideofor

    hy,
    try out:
    select s.name, sp. sp_sales total_sales
    from salesperson s,
    (select salesperson_id,sum(tot_sales) sp_sales
    RANK() OVER (ORDER BY SUM(tot_SALES) desc) SALES_RANK
    FROM ORDERS
    WHERE YEAR = 2006
    group by salesperson_id) sp
    where sp.sales_rank <= 5 (...n)
    and sp.salesperson_id = s.salesperson_id
    order by sq.sales_rank;
    give result in:
    name total_sales
    a 100
    b 90
    c 80
    d 70
    e 60
    hope help you
    regards

  • How can I create a view of top five teams averages based on individual averages of that team?

    I have created a list that groups teams by their Team name (Team column) with the individuals members (participants column) averages and their team average (total average view option).  I want to only display the top five teams that have the overall
    top team averages.  I have a list that contains a team name, average minutes, week, and participant. The team manager plugs in each week a new entry for each participant on the team.  I have a view that computes each team average but I want a view
    of the top five teams based on the top averages of the team (not individual participant average).  Unfortunately, I can only seem to get all teams grouped with individuals of that team, their individual averages and the team average but can't figure out
    only how to show the top five teams top average.  Because it's a total (team average) and not a separate column, I can't get a view by team based on total average.  I can by top individual average but not by the team.  Can some one help me figure
    out a solution?

    A calculated column won't work because a calculated column can only reference the individual item, not the entire list or a subset.
    You could do javascript to build this, but to me it's easier to just use Excel.
    Andy Wessendorf | Solution Foundry [email protected]

  • Selecting Top N records in a table using a slider or drop down list

    Hi Experts,
    I have a query that  displays 1000 records ( say) in VC iview.
    Can i have a drop down list in the variable form to control the number of records displayed in the output table by the user .
    or can i have a horizaontal slider ( Min value is 2 -max 1000)  to display the number of records in the output table  selected by the horizaontal slider.
    basically iam having a requirement to give the user the capability to select the Top N records of the output table...where the user enters the N value in Drop downlist of variable form or user slides the N value using Horizontal slider
    Thnaks
    P.Navakanth

    Hi
    Yes it is possible. First you need to create 'Condition' in BEx query where you have to create 'TOP N' & 'N' should be a variable input. Then you will get this in 'Variable Screen' of a query. In VC for this same variable you can use slider. Use 'Select' function in the 'Action' of the slider & pass it to require table/graph.
    Try this, this will give you the required result.
    Regards
    Sandeep

  • How to find out top 10 records from the R/3 using Java code (WD Program)

    Hi Experts,
    I have used Java Web Dynpro program to fetch records from the backend. Following code helps me and fetches record. As per the customer reqirement, we have to fetch only top 10 records (Actual Cost) from the backend. So I have to modify the Java code. How I can do so? Please help.
              wdContext.nodeGraphData().invalidate();
              IPublicCostcnt.IGraphDataElement categoryElement;
                   for (int i = 0; i < wdContext.nodeItab_Final1().size(); i++) {
                   categoryElement = wdContext.createGraphDataElement();
                   categoryElement.setCostElement(""+ wdContext.nodeItab_Final1().getItab_Final1ElementAt(i).getDescription());
                   categoryElement.setActualCost(wdContext.nodeItab_Final1().getItab_Final1ElementAt(i).getActual_Cost().toString());
                   categoryElement.setPlannedCost(wdContext.nodeItab_Final1().getItab_Final1ElementAt(i).getPlan_Cost().toString());
                   wdContext.nodeGraphData().addElement(categoryElement);
    Regards,
    Gary

    Dear SDN Users,
    This is how I resolved the issue.
    1) Requested ABAPer to provide me sorted data. The data has been sorted in descending order of actual_cost.
    2) After that I used following code. This resolved the issue.
         if (wdContext.nodeItab_Final1().size()>10){
         IPublicCostcnt.IGraphDataElement categoryElement;
              for (int i = 0; i < 10; i++) {
              categoryElement = wdContext.createGraphDataElement();
              categoryElement.setCostElement(""+ wdContext.nodeItab_Final1().getItab_Final1ElementAt(i).getDescription());
              categoryElement.setActualCost(wdContext.nodeItab_Final1().getItab_Final1ElementAt(i).getActual_Cost().toString());
              categoryElement.setPlannedCost(wdContext.nodeItab_Final1().getItab_Final1ElementAt(i).getPlan_Cost().toString());
              wdContext.nodeGraphData().addElement(categoryElement);
         if (wdContext.nodeItab_Final1().size()<=10){
         if (wdContext.nodeItab_Final1().size()>0){
         IPublicCostcnt.IGraphDataElement categoryElement;
              for (int i = 0; i < wdContext.nodeItab_Final1().size(); i++) {
              categoryElement = wdContext.createGraphDataElement();
              categoryElement.setCostElement(""+ wdContext.nodeItab_Final1().getItab_Final1ElementAt(i).getDescription());
              categoryElement.setActualCost(wdContext.nodeItab_Final1().getItab_Final1ElementAt(i).getActual_Cost().toString());
              categoryElement.setPlannedCost(wdContext.nodeItab_Final1().getItab_Final1ElementAt(i).getPlan_Cost().toString());
              wdContext.nodeGraphData().addElement(categoryElement);
    Regards,
    Gary

  • How to Get Top 10 records using SQL select statement.

    :-) Hiee E'body,
    I want to generate a sql report in which I only want the top 10 records based on the numeric value of a column.
    For Example,
    To generate a Location Wise, Employee Wise Years of Service Report.
    Here I need the Top 10 Employees according to their No. of Years of Service for all the existing locations using a single query.
    eg.
    Location Emp No. YOS
    India - 22 30
    212 28
    819 24 ...
    US 123 40
    312 33
    90 33
    144 30 ...
    UK 77 20
    79 20
    331 18
    109 16 ...
    Every Location should display their respective Top 10 Employees
    regarding their No. of Years of Service.
    Please let me the know the solution to this.
    Have a nice day.
    Thanking You,
    Vivek Kapoor.

    For example if the table contained (India rows only shown) :
    India 202 30
    India 212 28
    India 819 24
    India 820 24
    India 900 20
    India 920 18
    India 922 17
    India 925 16
    India 926 15
    India 927 14
    India 928 13
    India 929 13
    India 930 12
    do you want to see
    India 202 30
    India 212 28
    India 819 24
    India 820 24
    India 900 20
    India 920 18
    India 922 17
    India 925 16
    India 926 15
    India 927 14
    or
    India 202 30
    India 212 28
    India 819 24
    India 820 24
    India 900 20
    India 920 18
    India 922 17
    India 925 16
    India 926 15
    India 927 14
    India 928 13
    India 929 13
    Also if the India rows were
    India 202 30
    India 212 30
    India 819 30
    India 820 30
    India 900 30
    India 920 30
    India 922 30
    India 925 30
    India 926 30
    India 927 30
    India 928 30
    India 929 30
    do you want to see
    India 202 30
    India 212 30
    India 819 30
    India 820 30
    India 900 30
    India 920 30
    India 922 30
    India 925 30
    India 926 30
    India 927 30
    or
    India 202 30
    India 212 30
    India 819 30
    India 820 30
    India 900 30
    India 920 30
    India 922 30
    India 925 30
    India 926 30
    India 927 30
    India 928 30
    India 929 30
    Please clarify.
    Thanks,
    Partha

  • How to retrive one table records into another table by multiple records

    how to retrive table X records into another table Y by multiple records (means at once i want display 10 records) in form 6i .
    when i am written cursor it is ftching only one record.But i want to display all records at once.
    Declare
    Cursor cur_name is
    select PROTOCOL_NO,DOCNUM,SUBSETSN,REPEATSN,AESEQ,AETERM from coding_ae WHERE PROTOCOL_NO='KP229';
    Begin
    open cur_name;
    loop
    fetch cur_name into :PROTOCOL_NO,:DOCNUM,:SUBSETSN,:REPEATSN,:AESEQ,:AETERM;
    exit when cur_name%notfound;
    next_record;
    end loop;
    close cur_name;
    End;

    Hi,
    Make sure the cursor is in the detailed block. For that use 8GO_BLOCK* built-in. So the code will be
    Declare
    Cursor cur_name is
    select PROTOCOL_NO,DOCNUM,SUBSETSN,REPEATSN,AESEQ,AETERM from coding_ae;
    Begin
    GO_BLOCK('<detailed_block_name>');
    open cur_name;
    loop
    fetch cur_name into :PROTOCOL_NO,:DOCNUM,:SUBSETSN,:REPEATSN,:AESEQ,:AETERM;
    exit when cur_name%notfound;
    next_record;
    end loop;
    close cur_name;
    End;Regards,
    Manu.
    If my response or the response of another was helpful or Correct, please mark it accordingly

  • How to select top 10 records

    How can I use SQL to select the top 10 records (do not use cursor)

    ... not only that but the order by and rownum check cannot be done in the same select. You need an in-line view.
    select * from
    (select * from table
    order by whatever)
    where rownum < 11
    BEWARE: Incorrect use of rownum (which is very common) often returns the correct result by accident, but you cannot guarantee that the accident will continue to happen.

  • How to order/get top 10 records of Business Object

    Hi Guys,
    I need some help here.
    Im trying to find out how should I go about ordering my return results by .findByMultipleParameters.
    Is there a simple method to also get eg. top 30 records after sorting the results?
    There are some new class - OrderBy, Paging in 7.11 (EhP1 SP02) but I'm not on this version yet.
    Thanks all for your help in advance.
    Thanks.

    Hello Bertina!
    I think you talk about it:
       List<QueryFilter> list = new ArrayList<QueryFilter>();
       list.add(QueryFilterFactory.createFilter("products.name", Condition.EQ, "Pen"));
       list.add(QueryFilterFactory.createFilter("products.code", Condition.EQ, 30));
       OrderBy orderBy = new OrderBy("products.name");
       Paging paging = new Paging(10);
       myService.findByMultipleParameters(lista, orderBy , paging, "");
    A sample code, that is work fine for you.
    Regards, Ronaldo.
    Edited by: Ronaldo Rampelotti on Jun 18, 2009 10:36 PM

  • Layout and Pagination... Limiting my data to top 500 records

    Hi,
    My report is based on SQL, it's displaying only top 500 records... May I know how to fix it...?
    I've tried different options under Report attibutes -> Layout and Pagination but no success yet
    Thanks

    Try closing OAE and the application if running.. Seems like the changes don't take effect until you come back into OAE... At least that is what mine does.

  • Finding top five number in an array of arraylists.

    I have to write a method with a heading
    public static int [] findTopFiveMostSteps ( ArrayList [] temp )i will input an array of arraylists, and I have to write this method
    that will return a integer array containing the top five number in that
    array of arraylists.
    I have no idea how to go on about this
    please help

    How would you do it "manually"? That is, if you just
    had pencil and paper and several lists of numbers,
    what would be the steps? Keep them very simple and
    precise.Socrates would be so proud.
    I was just reminiscing about how I once tried to teach Java to the web designer
    at my last job. I gave him the task of writing:
    static int max(int[] values) He just didn't grok it:
    Me: How would you figure it out by hand?
    WD: I'd look at the numbers and pick the biggest.
    Me: Break that down into steps.
    WD: I'd -- look -- at -- the -- numbers -- and -- pick -- the -- biggest.
    In the end, we tacitly agreed to stop the teaching and hope the manager didn't notice.

  • To display top 7 records in the dashboard

    hai,
    while iam creating the a report with top 7 records to be displayed but, it dispalys only 5.
    plz let me know the correct way to approach it.
    thanks in advance.

    yah! the data is displayed by using "is in Top" function as a filter.
    7 records are displayed, without the year column.
    thanks we found the answer. we think that only year column, which is displayed in that table view made this issue.
    thanks for response....
    thanks kishore..... sorry to disturb ur time.

  • AV - Top Five Audit Sources by Number of Alerts - INTERNAL ERROR

    Hi again!
    We have one problem with audit vault console while connecting with auditor role.
    There's one strange problem that occurs intermitently when clicking on "Top Five Audit Sources by Number of Alerts " graph on audit vault home page.
    Sometimes it works perfectly and maybe next time it produces an internal error. It does not follow any logic. Maybe it works 1,2,3,... times and next one it doesn't and the links carriess you to an empty page with "INTERNAL ERROR" message.
    It is something related with the url.
    When you place the mouse coursor on the graph you can see the url at the bottom of internet explorer/firefox.
    It's something like this: (it works)
    http://<av hostname>:5707/av/console/database/avt/:::::P2_REPORT_TYPE,P2_DATE_TYPE,P2_SOURCE:WARNING_ALERT,DAY,<source name>
    then you continue working come back to home page and place the cursor again on it. Then sometimes you see the same url(all it's going to work) or the next one:
    http://<av hostname>:5700/av/console/database/avt/:::::P2_REPORT_TYPE,P2_DATE_TYPE,P2_SOURCE:WARNING_ALERT,DAY,<source name>
    As you can see port number has changed misteriously... and it does not work.
    The strange thing is that after the error i try to open a new auditor session with another explorer and it some times it works!!! until same thing happens.
    Has anyone seen anything like this????? I don't know if it something about Audit Vault configuration, a bug or an internet explorer configuration issue.
    i've tried different languages with my explorers and it continues happening ...
    All the rest of the parts of the application work perfectly
    Thanks!

    Whenever posting here ALWAYS include full version number.
    Whenever posting an error post the full and complete error message (not your interpretation of it). "INTERNAL ERROR" in and of itself is meaningless.
    I would suggest that you open an SR at metalink.

  • Changing default Top 200 records

    Hi and thank you for your help...
     I don't seem to understand the logic of defaulting to the " Edit top 200 records" ...Can the default "Edit Top 200 Rows" be changed to let's say top 2000?

    you can.
    Change the value in below setting
    This is accessed from top menu Tools -> Options
    Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs

Maybe you are looking for

  • Hi,  So I'm having a problem with Adobe Acrobat 10

    Hi, So I'm having a problem with Adobe Acrobat 10. I have backed up adobe acrobat files and stored them on an external hard drive. When I attach the external hard drive to one laptop I can open the acrobat files just fine but when I try to open the f

  • IPhoto 6 Crashes After Launching Every Single Time -- Help!

    This just started happening the other day. iPhoto crashes within 10 seconds of launching, and it does this every time. I can't find support for this issue out there, hoping someone can help in here. I tried repairing permissions from my hard drive, r

  • Help required on configuring Auto Login...!

    Hi All, I'm using SUn ONE Webserver Service Pack 9. And once after starting my Web Server instance and when ever I invoke my application url (http://localhost:8080/) It automatically takes me inside the application. I need to remove this auto login c

  • Smudge Tool Double Brush Bug Issue

    I have a very strange problem that just appeared in my copy of Adobe Photoshop CS5 Version 12.0 x32 Out of nowhere I've noticed that when I use the Smudge Tool my brush will randomly have 2 points instead of one.  I've looked all through my brush set

  • My screen is distorted blurred and some weird funky colors what is wrong and how can I fix it

    My screen is distorted, blurred and some funky weird colors very hard to read.  What is wrong and can it be fixed