Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8906337
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T02:37:39+00:00 2026-06-15T02:37:39+00:00

I have tried various grouping options for the following data in order to get

  • 0

I have tried various grouping options for the following data in order to get the record for highest bid ONLY for each car but have had no success. I think I am overlooking the obvious 🙂

bidId, carID, bidamount, dateplaced, userID  
45 83 650 5/11/2012 4:15:07 p.m. a5d383e0-0c2c-44cf-9da1-0ce364b1dbdc   
43 83 625 5/11/2012 4:12:51 p.m. a5d383e0-0c2c-44cf-9da1-0ce364b1dbdc   
41 83 600 5/11/2012 3:36:31 p.m. a5d383e0-0c2c-44cf-9da1-0ce364b1dbdc   
39 83 575 2/11/2012 4:06:57 p.m. a5d383e0-0c2c-44cf-9da1-0ce364b1dbdc   
56 83 575 9/11/2012 10:35:25 a.m. 0b3c2ba5-1538-4557-a6c0-7de701fd83e7   
52 83 550 8/11/2012 1:40:37 p.m. 0b3c2ba5-1538-4557-a6c0-7de701fd83e7   
38 83 550 2/11/2012 3:58:53 p.m. a5d383e0-0c2c-44cf-9da1-0ce364b1dbdc   
37 83 525 2/11/2012 3:58:19 p.m. a5d383e0-0c2c-44cf-9da1-0ce364b1dbdc   
49 83 525 7/11/2012 1:40:37 p.m. 0b3c2ba5-1538-4557-a6c0-7de701fd83e7   
80 86 750 21/11/2012 3:17:53 p.m. 0b3c2ba5-1538-4557-a6c0-7de701fd83e7   
69 86 725 20/11/2012 2:09:52 p.m. 0b3c2ba5-1538-4557-a6c0-7de701fd83e7   
68 86 700 20/11/2012 2:09:33 p.m. 0b3c2ba5-1538-4557-a6c0-7de701fd83e7   
59 86 675 13/11/2012 2:38:12 p.m. 0b3c2ba5-1538-4557-a6c0-7de701fd83e7   
53 86 650 8/11/2012 10:35:25 a.m. 0b3c2ba5-1538-4557-a6c0-7de701fd83e7   
47 86 625 5/11/2012 5:45:08 p.m. a5d383e0-0c2c-44cf-9da1-0ce364b1dbdc   
46 86 600 5/11/2012 5:45:04 p.m. a5d383e0-0c2c-44cf-9da1-0ce364b1dbdc   
44 86 575 5/11/2012 4:15:02 p.m. a5d383e0-0c2c-44cf-9da1-0ce364b1dbdc   
42 86 550 5/11/2012 3:36:40 p.m. a5d383e0-0c2c-44cf-9da1-0ce364b1dbdc   
40 86 525 5/11/2012 3:33:36 p.m. a5d383e0-0c2c-44cf-9da1-0ce364b1dbdc   
66 89 675 15/11/2012 4:21:40 p.m. a5d383e0-0c2c-44cf-9da1-0ce364b1dbdc   
65 89 650 15/11/2012 4:21:36 p.m. a5d383e0-0c2c-44cf-9da1-0ce364b1dbdc   
64 89 625 15/11/2012 4:21:15 p.m. a5d383e0-0c2c-44cf-9da1-0ce364b1dbdc   
63 89 600 15/11/2012 4:18:10 p.m. a5d383e0-0c2c-44cf-9da1-0ce364b1dbdc   
62 89 575 15/11/2012 4:17:57 p.m. a5d383e0-0c2c-44cf-9da1-0ce364b1dbdc   
61 89 550 15/11/2012 4:17:54 p.m. a5d383e0-0c2c-44cf-9da1-0ce364b1dbdc   
60 89 525 15/11/2012 4:17:51 p.m. a5d383e0-0c2c-44cf-9da1-0ce364b1dbdc   

I dont know why some experienced users here voted to close this as @dbaseman has almost answered my question and understood what i was asking. PLEASE REOPEN so @dbaseman can complete his answer.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T02:37:41+00:00Added an answer on June 15, 2026 at 2:37 am

    You can get an anonymous object with the car id and max bid by:

    1. grouping by carID
    2. selecting the grouping key + max by bidamount

    var maxBids = collection.GroupBy(item => item.carID)
        .Select(grp => new { 
            carId = grp.Key, 
            maxBid = grp.Max(grpitems => grpitems.bidamount) 
         });
    

    From there it’s easy to convert to a dictionary if you like:

    Dictionary<string, double> maxBidsByCar = 
        maxBids.ToDictionary(item => item.carId, item => item.maxBid);
    

    Edit

    Since you need the user, the query has to be a bit different than above — here I ordered by bid amount and date placed, and took the first item.

    var maxBids = collection.GroupBy(item => item.carID)
    
         // select the max bids (here maxBid is the entire row)
        .Select(grp => new { 
            carId = grp.Key, 
            maxBid = grp.OrderByDescending(grpitems => grpitems.bidamount)
                          .ThenBy(grpitems => grpitems.dateplaced).First()
         })
    
         // flatten the query to just get the max bid amount and user ID
         .Select(item => new {
             carId = item.carId,
             maxBid = maxBid.bidamount,
             userId = maxBid.userID
         });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Have tried various escape functions but can't seem to get the below working... .background-radial(@colour,
I have tried various methods to try and get this working correctly (I am
I have tried various configurations, but cannot get it working. I am wondering if
I cannot open an existing website in MonoDevelop. I have tried various options with
I have tried all of these various ways to set the value of the
I have searched the documentation and tried various techniques but have't found a suitable
I have various Debug.WriteLine messages, I tried to see those messages using export MONO_DEBUG_LEVEL=debug,
I have tried various techniques to check the values of user input in this
I have tried various link posted on SO,but not got reliable answer. Here is
I have tried various combinations and find that by simply generating a skeleton Rails

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.