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 7871927
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T02:03:35+00:00 2026-06-03T02:03:35+00:00

I have two tables, one called items and one called bids. Bids contains a

  • 0

I have two tables, one called items and one called bids. Bids contains a bunch of bids with an item_id. I am trying to get all the information on the item with the associated highest bid.

I tried doing something like

SELECT * FROM items JOIN bids ON items.id=bids.item_id GROUP BY item_id

However that seems to return the first bid, not the highest.

How could I get the highest?

  • 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-03T02:03:36+00:00Added an answer on June 3, 2026 at 2:03 am

    You need to use a subquery to discover the maximum bid value, then join that with your existing query to obtain all of the desired output data. Assuming that the bid value is in a column called value, and that the PK of the bids table is a column called id:

    SELECT items.*, bids.*
    FROM
      items
      JOIN (
        SELECT id, item_id, MAX(value) AS value FROM bids GROUP BY item_id
      ) AS maxbids ON items.id = maxbids.item_id
      JOIN bids    ON  bids.id = maxbids.id
    GROUP BY items.id
    

    If there are multiple bids of the maximum amount, this query will return all of them.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two tables, one contains a list of items which is called watch_list
I have two tables, one called cart and one called items. Now I want
i have two tables one is called addons and holds information about different addons,
I have two tables i need to query One called horse which contains the
I have two tables one called fs_note the other called dumy_fs_note I created after
So i'm having this problem. I have two tables (Oracle), one is called Destination
I have two tables, one called countries and one called country. Countries has both
I have two tables one called details and the other called c_details. Both tables
Let's say I have two tables one called Customers and one called CustomerAddresses. Then
I have two tables, one called Users and one called Groups . I also

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.