0
大家好,我得到一个SQL查询,我只是不知道类,并想知道我可以得到一些帮助。这里的问题是: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
上'GROUP BY' – Paddy
你在使用阅读吗? mssql,mysql,oracle – Arion
mysql/oracle Arion – KageArarshi