에 대한 레코드의 총 수를 찾는 I 다음 MySQL의 쿼리가 : 완벽하게 작동하지만, 지금은 각 위치 ID에 대한 책의 총 수를 표시 할 필요가주어진 위치
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
합니다. 예를 들어 location_id 986에는 17 권의 책이 있고 location_id에는 34 권의 책이 있습니다. 이 정보를 얻기 위해 두 번째 쿼리를 실행해야합니까, 아니면 내가 가진 쿼리에서이 작업을 수행 할 수 있습니까?
감사 짐
당신은 인벤토리의 또는보다 일반적인 상황에서 맥락에서이 정보를 원하십니까 "이 위치에 얼마나 많은 책이있다"? – Sebas
선택한 각 위치 (이 경우에는 986 - 989)에 대한 도서의 총 수를 표시해야합니다. 감사합니다 – Jim
다음 내 대답을 확인하십시오 – Sebas