View Full Version : Please help with this query


msaunders26
02-25-2008, 06:38 AM
Hi everyone,

I have three tables, set up like this,

Auctions:
Auction ID, Winner ID # (a Customer ID, as shown below), Price

Bids:
Auction ID, Customer ID, Price

Customers:
Customer ID, Name

I need to find a query that does this functionality:
For each auction (entry in the Auctions table), if Bob didn't win the auction (Auctions.WinnerID =! Bob), but Bob has made a bid (For that auction, Bob is in the Bids table), show the difference between the Winner's price and Bob's price (Auctions.Price - Bob's price for that auction as shown in the Bids table)

I suppose the output table would look something like:
Auction ID, Winner's Price, Bob's Bid Price, Difference Between the two

I hope this is clear. Your help is greatly appreciated. THANKS!

Paul Buttress
02-25-2008, 07:08 AM
Thar ye go..Paul