vendredi 9 octobre 2015

SQLite3 Query - Incorrect output

I am running 1 specific query over my database in SQLite3 and it is giving me the wrong output.

The question that I posed for myself is to:

Find the total number of itemID's of auctions with the highest current price.

The answer is 1,046,871,451, however I get 300k more than that.

There are my tables/relations:

  • Item (ItemID, Name, Currently, Buy_Price, First_Bid, Number_of_Bids, Started, Ends, UserID, Description)

  • User (UserID, Rating, Location, Country)

  • Category (ItemID, Category)

  • Bid (ItemID, UserID, Time, Amount)

This is my attempt:

SELECT ItemID
FROM Item
WHERE Currently
IN (SELECT MAX(Currently) FROM Item);

I am really at a lost and would like any input about my query. Many thanks in advance.

Edit Note: Currently = the current price of the item.

Aucun commentaire:

Enregistrer un commentaire