I have the following mysql query:
SELECT sku, quantity, inventory.isbn13, author, title, pub_date, binding,
defect.defect, source, location from inventory
LEFT JOIN location ON inventory.location_id = location.location_id
LEFT JOIN source ON inventory.source_id = source.source_id
LEFT JOIN book ON inventory.isbn13 = book.isbn13
LEFT JOIN defect ON inventory.defect_id = defect.defect_id
LEFT JOIN book_condition ON book_condition.condition_id = defect.condition_id
WHERE quantity > '0' and location.location_id >= '986' and location.location_id <= '989'
ORDER BY inventory.location_id, sku
Which works perfectly, but now I need to show a total number of books for each location id. For example location_id 986 has 17 books, location_id 987 has 34 books etc.
do I need to run a second query to get this information or is there a way to do this in the query I have?
Thanks
Jim
here you go: