Ordering by date for multiple sub queries?
Posted: Fri Aug 13, 2010 4:17 pm
Okay, I'm a little confused here on the best way to approach this. Here's a simplified version of what I have..
Auction site
Tables: users, bids
Let's assume an auction is over. To determine who the winner is, we do this
Any suggestions? Thank you!
Auction site
Tables: users, bids
Let's assume an auction is over. To determine who the winner is, we do this
This is simple because we know the auction_id... Now what if we want to list all won auctions for a given user? I have no idea... because each auction needs to be ordered by bid_dt DESC and limit 1... I've tried with a sub query, but no luck......SELECT user_id FROM bids WHERE auction_id = '1'
ORDER BY bid_date DESC
LIMIT 1
Any suggestions? Thank you!