adrian28uk Posted April 20, 2007 Share Posted April 20, 2007 I have decided to have a crack at creating a mini auction site in my spare time, simply out curiosity and something that I can learn from in the future. I have created two simple tables, one for auctions and the for bids and manaully populated this through PhpMyAdmin. For trial purposes Auction 21 has 3 bids on it. I have managed to join the two tables together using the INNER JOIN statement and can output the results of the auctions. $result = mysql_query("SELECT * FROM auctions a INNER JOIN bids b ON a.auction_id = b.auction_id GROUP BY a.auction_id"); I am trying to order the bid_amount in the bids table to show the highest bid, but what it is doing is just showing me the first. Auction 21 has 3 bids and 57.00 is the highest bid. auction_id auction_title Start Bid Last Bid 21 Test auction 0.01 23.00 Here are my tables // auctions auction_id auction_title start_price // bids auction_id member_id bid_amount bid_date Link to comment https://forums.phpfreaks.com/topic/47867-creating-a-mini-auction-for-learning-purposes-stuck-with-inner-join-problem/ Share on other sites More sharing options...
Michael Lasky Posted April 20, 2007 Share Posted April 20, 2007 Try: "SELECT * FROM auctions a INNER JOIN bids b ON a.auction_id = b.auction_id GROUP BY a.auction_id ORDER_BY b.bid_amount DESC" or "SELECT * FROM auctions a, bids b WHERE a.auction_id = b.auction_id GROUP_BY a.auction_id ORDER_BY b.bid_amount DESC" Untested Link to comment https://forums.phpfreaks.com/topic/47867-creating-a-mini-auction-for-learning-purposes-stuck-with-inner-join-problem/#findComment-233975 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.