I have a little problem with multi-user request. (RDBMS: Access)
Here is the database schema: (only S_Cards, Books, Authors, Students tables are used in this query) S_Cards - the order of students' books (in the library).

Query: Select the most popular authors (s) among students and the number of books by this author that have been ordered in the library.
Although I can get a list of orders + authors like this in one query:
SELECT Students.FirstName & " " & Students.LastName AS [Student], Books.Name AS [Book], Authors.FirstName & " " & Authors.LastName AS [Author] FROM Students, Books, S_Cards, Authors WHERE S_Cards.ID_Student = Students.ID AND S_Cards.ID_Book = Books.ID AND Books.ID_Author = Authors.ID ORDER BY Authors.LastName
Result (sorry, this is in Russian):

I cannot understand why I cannot use COUNT and GROUP BY as follows:
SELECT Students.FirstName & " " & Students.LastName AS [Student], Books.Name AS [Book], COUNT(Authors.FirstName & " " & Authors.LastName) AS [Number of books] FROM Students, Books, S_Cards, Authors WHERE S_Cards.ID_Student = Students.ID AND S_Cards.ID_Book = Books.ID AND Books.ID_Author = Authors.ID GROUP BY 3
I get the error "Authors.FirstName" and "Authors.LastName" is not part of a static function or group.
Questions:
- Is there a way to make this query without a JOIN, only using GROUP BY, SELECT, UNION, and how?
- What is the problem in my second request?
source share