I have a table Books, where I store Book data (ISBN's, Titles, Authors, etc.). To tell which books are editions of each other I have a field Edition_Group_ISBN, which is an arbitrary ISBN from the group.
I'm having trouble getting this query, which is supposed to give the Book data and the number of other Editions based on the ISBN, to work:
SELECT *, Editions_Count
FROM Books
LEFT JOIN ((SELECT Edition_Group_ISBN, COUNT(*) AS Editions_Count
FROM Books
WHERE Edition_Group_ISBN IN (SELECT Edition_Group_ISBN
FROM Books)
GROUP BY Edition_Group_ISBN) AS b
) ON (Books.Edition_Group_ISBN = b.Edition_Group_ISBN
AND Books.Edition_Group_ISBN != NULL)
WHERE ISBN = 9780140447897
The query gives the book data for 9780140447897, but it gives the Editions_Count AS NULL, indicating that the LEFT JOIN isn't working.