I recently completed the SQLmodel documentation, but it doesn't tell me how to use the group_by command. I am trying the following:
SELECT reader_status, count(book_id)
FROM readerbook
WHERE reader_id=1
GROUP BY reader_id, reader_status
to be used in the SQLmodel code.
statement = select(
ReaderBook.reader_status, func.count(ReaderBook.book_id).label("count")
)
This is my code. How do I use the group_by "reader_id" condition ?