Getting a list instead of a single record.

Hello Experts,
I’m trying to get a record out of a table with the highest amount of money. I’ve used the following query to get the maximum about of money sitting in the table and it gave me the results.
SELECT MAX(auction_item.item_highest_bid)
FROM `auction_item`
I also need two more fields from the same table. Item_id and seller_id. Now what happens is when I write the following SQL I get a list of records instead of a SINGLE record with the highest amount of money.
SELECT MAX(auction_item.item_highest_bid),
auction_item.item_id,
auction_item.seller_id
FROM `auction_item`
GROUP BY auction_item.item_id,
auction_item.seller_id
Can please somebody shows me what’s wrong with my query and how I can get SINGLE record instead of list.
Thanks a lot in advance.

There are several ways to get this information - subqueries, analytical sql. A lot of it depends on the data.
Is there a possibility that two or more records will have the same MAX(auction_item.item_highest_bid)? And if so, how is this to be handled? I'm making some assumptions about item_id and seller_id...so take with a grain of salt
As an aside...you need to read up on GROUP BY and aggregation in sql as this scenario is explained in documentation/books.
Without the benefit of a database to test this, here are a couple of ideas
SELECT MAX(auction_item.item_highest_bid),
auction_item.item_id,
auction_item.seller_id
FROM auction_item
WHERE auction_item.item_highest_bid = (SELECT MAX(i_auction_item.item_highest_bid)
FROM auction_item i_auction_item
WHERE i_auction_item.item_id = auction_item.item_id
AND i_auction_item.seller_id = auction_item.seller_id)
Or
SELECT i.item_highest_bid, i.item_id, i.seller_id
FROM (SELECT a.item_highest_bid, a.item_id, a.seller_id
FROM auction_item a
ORDER BY a.item_highest_bid DESC) i
WHERE i.rownum = 1
Or
SELECT i.item_highest_bid, i.item_id, i.seller_id
FROM (SELECT a.item_highest_bid, a.item_id, a.seller_id, ROW_NUMBER() OVER (ORDER BY a.item_highest_bid DESC) bid_rank
FROM auction_item a) i
WHERE i.bid_rank = 1

Similar Messages

  • Single record in Export Error log - Essbase Adapter

    We are using FDM to load data to Essbase cubes. Currently in the export.err log file, we are getting the kickout details for a single record at a time. Is there any setting that would give us the entire list of kickouts in a sinlge log?
    Thanks.

    Use a load rule to load a data and you will get a error log listing all errors up to the max errors specified in the Essbase configuration. To use this method from FDM instead of the standard Adapter load check the Enable String Load option in the Adapter configuration settings and specify the name of the Load Rule you wish to use. Personally I would always go for the Load Rule option when loading Essabs from FDM

  • How do you get a list of records to scroll automatically instead of page

    I have a set of records displayed in a list control. The list
    currently pages through the records and displays two records at a
    time. I want to display all the records and have them scroll
    vertically like movie credits and allow users to adjust the speed.
    Does anyone know how this can be done.

    Take a look in the Flex Exchange for a component name
    flexwheel I think that's sorta what you're looking for.

  • Single record in PC-UI result list

    Hi Experts,
    By default in PC-UI result list if there is one single record, the application displays the details for that particular record. I have a requirement to suppress this behaviour and display the record details only when the user selects that particular record.
    Any clues on how can this be achieved.
    Thanks and Regards
    Piyush

    Hi Shailajam
    Thanks for your reply, I will try to check this out.
    On another note, what is the possibility if I want to set the mode of this single record to "Display" mode instead of "Change" mode. This would also be another possible option to achieve this requirement.
    Any thoughts on the same??
    Regards
    Piyush

  • Getting error " Incomplete update due to error in single records"

    Dear All,
    We are loading data from DSO to Cube using full load and the load is failing giving an error message Collection in the source system ended and when checked the error message button it is showing as  " Incomplete update due to error in single records" . and also one more message "Messages (type E) for data records with record number 0
    Message no. RSM2714". Can any one tell us the reason for the failure of this load ? and how to resolve it ?.
    When we click on the help button of the error message it is displaying the message as below
    Incomplete update due to errors in single records --> Long text
    Message no. RSM2712
    Diagnosis
    In the update rules, one InfoSource record was used to create several records in the data target. These records must be handled in the same way to enable tracking into the PSA and the treatment of errors in individual records.
    In the previous case, one record was updated in this kind of group generated by update rules, whereas other records in the same group were rejected. If you updated the PSA data record again, the records that were already updated would be updated again. Duplicate records would appear in the data target and the data target would thus be inconsistent.
    System Response
    The data record with errors was highlighted in the PSA. However, no error request was generated.
    Procedure
    Delete the request in the data target and, after removing the error, update all records for the request to the data target again.
    Regards,
    JayaKrishna

    hi,
    Can you please check out the PSA error record and check this out in Source DSO as this load is for DSO -> Cube....
    Please correct it in PSA if this is not correct as per DSO ....prior correcting data in PSA pls delete the request from Cube.....then it will allow to correct or delete record in PSA and then further push data from PSA to Target Cube...
    If its correct as per DSO then run load in DSO sometime few records wrongly updated by  end user and they correct it by evening for Submission....So u will get the corrected record and then run manually further load to Cube...
    Hope this will help....
    Regards,
    Mahesh

  • Report to Get the List of Personnel Numbers in COntrol Record

    Hi Folks,
    In Pao3-Control Record, we get the List of Personnel Numbers active for the current month in a Particular Payroll area, For one particular payroll area, we have around 1000 numbers , is there any standard report available to get the employee list along with personnel  numbers from the control record.
    Regards,
    Sekar.

    You can try using Flexible Employee Report.
    Choose Payroll Area as Input
    Choose Personnel Number and Employment status as Output.
    Try this.

  • I've found no way to sort.  For example, if I type the group "Rush" into the search bar, I get a list of songs recorded by rush and literally thousands of other songs and artists with the word rush in them. There is; however, no way to sort the results.

    I've found no way to sort search results in itunes.  For example, if I type the group "Rush" into the search bar, I get a list of songs recorded by rush and literally thousands of other songs and artists with the word rush in them. There is; however, no way to sort the results. 

    In the Search box click on the black Arrow and UNTICK the Search Entire Library.
    Then the Search results in Songs view will be displayed in the main Grid and you can sort them by clicking on the column headers.
    You can also turn on the column browser which can help with filtering

  • My current project in the events library has gone into list mode. ie a single clip on the left, one above another, so showing only about 7 clips. how can I get it back into normal horizontal mode

    My  current project in the Events Library has gone into list mode. ie a single clip on the left one above another, so showing only about 7 clips. How can I get it back into normal horizontal mode?

    That's about what it's supposed to look.
    How do You want it to look ?
    a. You can change places by using this
    b. May be You changed this top right symbol of an hard disk ?
    c. or changed the number of frames to be viewed ?
    d. OR - it can (at least for me) be so that You think of how it looks in iPhoto. (To me a very common mistake)
    Yours Bengt W

  • Selecting single record from multiple record based on date

    Hi experts,
    I have a table which contains the multiple records for single ID No. Now i have to select single record which contains the latest date.
    here is the structure
    Name   Null Type        
    ID_P        NUMBER      
    NAME_P      VARCHAR2(12)
    DATE_P      TIMESTAMP(6)
    Records
    1 loosi     22-AUG-13 01.27.48.000000000 PM
    1 nammi  26-AUG-13 01.28.10.000000000 PM
    2 kk        22-AUG-13 01.28.26.000000000 PM
    2 thej      26-AUG-13 01.28.42.000000000 PM
    now i have to select below 2 rows how can write select qurie for this?
    1 loosi     26-AUG-13 01.27.48.000000000 PM
    2 thej      26-AUG-13 01.28.42.000000000 PM

    Hi,
    You can use the analytic ROW_NUMBER function.
    I don't have a copy of your table, so I'll use scott.emp to illustrate.  In scott.emp, there may be multiple rows for a single job.  To display just 1 row per job, the row with the most recent hiredate:
    WITH got_r_num AS
         SELECT  empno, job, deptno, hiredate -- Or whatever columns you want
         ,       ROW_NUMBER () OVER ( PARTITION BY  job
                                      ORDER BY      hiredate DESC
                                    )  AS r_num
        FROM    scott.emp
    --  WHERE ...   -- If you need any filtering put it here
    SELECT   *      -- Or list all columns except r_num
    FROM     got_r_num
    WHERE    r_num   = 1
    What results do you want in case of ties?  Depending on your requirements, you may want to add tie-breaking expressions to the analytic ORDER BY clause, and/or use RANK instead of ROW_NUMBER.
    I hope this answers your question.
    If not, post a little sample data (CREATE TABLE and INSERT statements, relevant columns only) for all the tables involved, and the results you want from that data.
    Point out where the query above is producing the wrong results, and explain, using specific examples, how you get the right results from the given data in those places.
    If you modify the query at all, post your modified version.
    Always say what version of Oracle you're using (e.g. 11.2.0.2.0).
    See the forum FAQ: https://forums.oracle.com/message/9362002

  • Create a Formatted report for a single record

    I am trying to create a report for a single record in a document format instead of row and column format
    For example to list a custome information with list of orders.
    CustomerID ---------------------        Name ------------------------------------
    Address 1 ----------------------         Address 2 ------------------------------
    City --------------------------------        State -------------------------------------
    Zip ---------------------------------
    Order List
    Order 1            Qty          Total Cost
    Order 2            Qty          Total Cost
    We dont have crystal reports setup yet.  I am trying to use report designer...but it is not allowing me to do it.  It creates different group for each row in the query.   Can any one suggest how to do it using report designer or another way in BI 7.0 to create this kind of document.   I want to be able to print this document as pdf or other types.
    Any help is greatly appreciated..
    Thanks

    you can do this both in a formatted report or bex, depending on what kind of an outcome that you are looking for.
    basically, you are first going to present the data in a tabular format and then move the cells around, so the next time you execute the report (analyzer or report designer) it will stay in that format.
    if you are doing it in report designer, first create a query that pulls all required data points and gives them to you in an output as a table.  Then, add that query as a data provider for the formatted report, and you can create additional cells and move the key figures around.  Report designer is a little crude for formatting, but it works
    if you are doing this in BEx Analyzer, then you can do the same thing: create a query and then use the BExGetData formula to pull the required data into required cells
    if you are looking for HIGHLY formatted report (for example you want the output to come out on forms, etc), then you would need to use the Crystal Reports.
    Regardless of what you use for the presentation of the data, the data generation is controlled by the Query itself.  This is one of the tools that SAP is not planning to take away: all the future presentation options will use the query as the data source.
    good luck

  • Getting a list of distinct values

    Hello,
    I'm using Toplink named queries with an sql-expression (in JDev Studio 10.1.0.3.) but I'm having trouble to get distinct values.
    I want to create a dropdown list containing all pricerange possibilities, the basic data comes from a table with following format:
    PRICERANGE_ID -- ACTIVITY -- PRICE
    LOW--------------------- Analysis ---- 65
    LOW -------------------- Training ----- 75
    MEDIUM -------------- Analysis ---- 75
    MEDIUM -------------- Training ----- 90
    HIGH ------------------- Analysis ---- 85 etc.
    I have now created a TopLink named query, type: ReadAllQUery,
    SQL statement: select pricerange.PRICERANGE_ID from pricerange
    group by pricerange.PRICERANGE_ID
    order by pricerange.PRICERANGE_ID
    and PRICERANGE_ID is part of the primary key of pricerange (but I don't expect this to be a problem)
    Now, when I use this query to get the values in a dropdown list, I don't get any values as a return. I have tested in pure SQL (using TOAD) in which I was able to get the correct value for each record.
    My guess is that is some problem with defining row names in this TopLink query. Since I ask only to select the data of one column, but when I want to create a dropdown list I get a list of all fields in the original table.
    Can you limit the selection to certain fields or columns in a TopLink named query ? Are there other options ?
    I have posted this question on the Toplink forum and did get the suggestion of Doug Clarke to use a ReportQuery instead of a ReadAllObjects query, but it's still not clear to me where and what I should do.
    Kind regards,
    Nemata

    This discussion is being followed up on at Re: getting a list of distinct values

  • How to get pages list for a group space or create a page for a group space

    hi All,
    I am using wc11.1.1.3, I want to use java api to implementing the following functions in site template:
    1. Get pages list for a given group space
    2. Create a page for a given group space
    I researched the following codes from web site:
    PageDef newPage = mPageService.createPage(
    PERSONAL_USER_PAGE, pageNameFormat, pageTitle,
    "MyPageTemplate1.jspx",
    "/mytemplates/",
    null, null, null);
    What should be used instead of PERSONAL_USER_PAGE if a group space page is intended to be created? which parameter is for defining group space name that the page should be created for?
    By the way, PageService seems has method for getting list of pages, but how to use it to get page list which is in a specified gs?
    Best regards

    did you manage to get the page list using Page Service API?

  • Trying to use Web LCID property to get the List name in client object Model

    Hi ,
    I am trying to change the "Personal Documents" list NoCrawl property under MySite using SharePoint Client Object Model. As we use  web.Lists.GetByTitle("Personal
    Documents"); method to get the list,but here problem is :for different language List name is in their language.So I tried to use LCID property of the WEB and
    have taken key-value pair (PersonalSiteOnet_List_PersonalDocuments) from the resource file for that language from 14 hive.
    Example:I have selected Spanish language .there are so many LCID for Spanish language but Microsoft has given only one language pack for Spanish.
    Then,My Question is that
    "All LCID for Spanish language are using same Spanish language pack dictionary file OR something else"
     

    Hi,
    According to your post, my understanding is that your requirement is getting list in different language.
    Here are two ways for your reference:
    1. We can use getById method instead, so that we can avoid the language issue.
    2. We can use an array to store the different list name in different language in you JavaScript code, then use the code snippet below to get the list:
    var userLcid =_spPageContextInfo.currentLanguage;
    var localizedStrings = {
    ListName: {
    _1033: "EnglishName",
    _3082: "SpanishName"
    var listName=localizedStrings.ListName["_" + userLcid];
    var list=web.Lists.getByTitle(listName);
    More information:
    http://msdn.microsoft.com/en-us/library/hh670609.aspx
    http://wellytonian.com/2012/11/language-packs-sharepoint-2010/
    Best Regards
    Dennis Guo
    TechNet Community Support

  • How to use execute query For a single record

    Hi All,
    I am working with oracle forms 10g, I have developed a custom form.
    I the form user enter some data and click save in the menu and data get inserted into my table. Inside the insert statement i have hardcoded some values, Once data get inserted i cant able to see that values immediately in my text fields in my form.After requerying i can able to see the changes.
    For example I have a text field called Status, and the field is display only field. At that time of insert i have hardcoded as "INCOMPLETE". Once the user enter the data in the form and click save the data get inserted in to my table but i cant able to see the status, after i requery my form i can able to see the status.
    Here i do multi insert also.
    This is my insert statement
    BEGIN
    First_Record;
    LOOP
    IF :BANK_GUARANTEE_BLK.CHECK_IN_OUT = 'Y'
    THEN
    XXBANK_GUARANTEE_HEADERS.XXBANK_GUARANTEE_INSERT;(this is my package, here i have written my insert statement)
    --Execute_query;
    END IF;
    Exit when :System.Last_Record = 'TRUE';
    Next_Record;
    END LOOP;
    END;
    If user insert only one row and i gave Execute_query to refresh and bring the current data, but when i use execute_query Its brings up all the datas in the table.
    Can any one tell me how to avoid this and how to use execute_query for a single record.
    Thanks &regards
    Srikkanth

    Solved,
    The solution is
    set_block_property('LC_REQ_BLK',ONETIME_WHERE,'LC_PO_NUMBER='||:LC_REQ_BLK.LC_PO_NUMBER);
    go_block('LC_REQ_BLK');
    execute_query;
    Works fine.
    Regards
    Sri

  • Concatenate multiple records into one single record

    Hello everyone,
    Can anyone guide me how to merge multiple records into one single record
    like......... I am getting the data in the file like
    aaaaa/bbbbbbb/ccccccccccc/dddddddddddd/eee
    ffffff/gggg/hhhhhhhhhhhhhh
    /123/4567/55555/99999999/kaoabfa/eee
    fffff/kkkkkkkk/llllllllllllllllllllllll
    when i use gui_upload I am getting the data into the internal table in the above format.
    My main intension is to split the record at / to multiple lines and dowload it into another file.
    What i am planning to do is... if the line does not start with / then i want to concatenate the multiple lines into single line and then split it into multiple records. Can anyone guide me how to achieve this.

    Yes, it should work.
    In my example
    Loop at itab.
    concatenate i_text itab into i_text.
    endloop.
    You change that loop for the loop of your internal table with the file records
    So if you have this three records
    'aaaa/bbb/ccc'
    '/dddd/efg'
    'hijk/lmn'
    i_text will look like this at the end
    'aaaa/bbb/ccc/dddd/efghijk/lmn'
    then in this part of the code
    split i_text at '/' into table itab2.
    itab2 will have the records looking like this
    aaaa
    bbb
    ccc
    dddd
    efghijk
    lmn'

Maybe you are looking for