I have a simple query that shows books written by a particular author, and counts the total number of books held in stock. The result returned from the query shows five columns. BookID, AuthorID, AuthorName, BookName and the total books held in stock.
My problem is that if a particular book has no stock held, the book name is not displayed in the result. I want the bookname displayed with a zero shown.
i.e.
1 1 Lee Child Personal 5
1 2 Lee Child Make Me 4
1 3 Lee Child The Visitor 0
1 4 Lee child One Shot 8
The sql for the query is shown below:
SELECT tblSale.BookID, tblAuthor.AuthorID, tblAuthor.AuthorName,
tblBook.BookName, Count(tblBook.BookName) AS [In Stock]
FROM (tblAuthor INNER JOIN tblBook ON tblAuthor.AuthorID = tblBook.AuthorID)
INNER JOIN tblSale ON tblBook.BookID = tblSale.BookID
GROUP BY tblSale.BookID, tblAuthor.AuthorID, tblAuthor.AuthorName,
tblBook.BookName, tblSale.BookInStock
HAVING (((tblAuthor.AuthorID)=[forms]![frmMain]![text12]) AND
((tblSale.BookInStock)=Yes))
ORDER BY tblAuthor.AuthorName;
I'd be very grateful for a solution to this irritating problem! Many thanks...