Код: Выделить всё
Список установленных, списанных и т.п. материалов со склада за период, по модели товара.
=============================
Запрос:
=============================
SELECT SUM(i.count) AS installation_count_sum, sta.name AS sta_name, i.type AS status
FROM storage_installation AS i
LEFT JOIN storage_incoming_articles sia ON ( sia.id = i.storage_incoming_articles_id )
LEFT JOIN storage_articles sta ON ( sta.id = sia.article_id )
LEFT JOIN storage_article_types sat ON ( sat.id = sta.article_type )
WHERE ((i.date>='2023-06-01' AND i.date<='2023-06-30'))
GROUP BY sta.name;