Skip to content

Commit 74673c9

Browse files
committed
fixed top_ten_borrowed_books view, should use count instead of sum
1 parent 8991ed8 commit 74673c9

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

docker/sample-postgres-library/init/1-library-schema-and-data.sql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88814,11 +88814,11 @@ CREATE OR REPLACE VIEW library.top_ten_borrowed_books AS
8881488814
books.pages,
8881588815
books.year,
8881688816
books.publisher,
88817-
sum(issue_details.id) AS issue_count
88817+
COUNT(issue_details.id) AS issue_count
8881888818
FROM (library.books
8881988819
JOIN library.issue_details ON (((books.id)::text = (issue_details.book_id)::text)))
8882088820
GROUP BY books.id
88821-
ORDER BY (sum(issue_details.id)) DESC
88821+
ORDER BY issue_count DESC
8882288822
LIMIT 10;
8882388823

8882488824

0 commit comments

Comments
 (0)