大家好,我有一个 sql 查询,我只是想不出上课,想知道我能得到一些帮助。这是问题:
显示“中标成员列表”:中标的成员列表以及该项目的项目名称、项目价值和中标金额。我的代码只显示所有这些中的最高出价,而不是每个成员的最高出价
和表格:
Member (username, lastName, firstName, title, address, city, postcode, country,
phoneBH, phoneAH, faxNumber, email, registrationDate, password, isBuyer,
isSeller)
Item (itemNumber, itemName, itemDescription, itemValue, itemLocation,
categoryID, sellerUsername)
Auction (auctionNumber, currency, startDateTime, endDateTime, shippingTerms,
startBidAmount, reserveAmount, bidIncrementAmount, noOfItems, itemSold,
itemNumber feedbackDateAndTime, rating, comments, paymentDate, paymentid)
Bid (bidderUsername, auctionNumber, bidDateTime,bidAmount)
SELECT B.bidderUsername, I.itemName, I.itemValue, B.bidAmount, A.auctionNumber
FROM Item I, Auction A, Bid B
WHERE A.auctionNumber = B.auctionNumber
AND I.itemNumber = A.itemNumber
AND B.bidAmount >= A.reserveAmount
AND A.endDateTime < SYSDATE
AND B.bidAmount = (SELECT max(B.bidAmount)
FROM dbf12.Bid B, dbf12.Auction A
WHERE B.auctionNumber = A.auctionNumber)
对于代码和表格,您可能需要选择代码/表格并推送ctrl-k