我需要编写一个 mySQL 语句来仅返回尚未租用的物品(书籍)。我有这个但我知道这是不对的那一刻:
SELECT books.copies
FROM books
WHERE books.copies > (SELECT rentals.book_id, COUNT(rentals.book_id) As CountRentals
FROM rentals
WHERE rentals.book_id = books.id )