Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Selecting the 3rd highest and 5th highest bidder 1

Status
Not open for further replies.

likeopensource

Programmer
Nov 28, 2002
27
IN
I am getting a little bugged , I got stuck on a similar problem twice.We have two tables lets say m_auc and d_auc

m_auc has (at least) the following columns

auction id, auction bidder id , auction price , bid_id.

auction_id,auction bidder_id and bid id form a composite key.

Another table has auction id and auction name.


After the auction process is finished , we have to pick the 3rd highest bidder and 5th highest bidder.

Even without the join, I am finding it difficult to get the 3rd highest and 5th highest bidders.Any solution in mysql,sql server,oracle or postgresql will be appreciated.
 
Not exactly what you want, but

[tt]select * from m_auc order by auctionprice desc limit 3,3[/tt]

should return the 3rd, 4th and 5th place bids.

You don't say what applicaion will use the results, but you should be able to pull the first and last result of the select to get the 3rd and 5th place bids outside of SQL. Alternatively, you could use two selects, and do limit 3,1 and 5,1 separately.

Mark --
How can you be in two places at once when you're not anywhere at all?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top