Changes between Version 3 and Version 4 of AdvancedReports


Ignore:
Timestamp:
01/21/22 17:03:30 (3 years ago)
Author:
193230
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • AdvancedReports

    v3 v4  
    129129}}}
    130130
     131== Извештај за вкупно продадени продукти по категорија
     132{{{#!sql
     133create view kategorija_produkti as
    131134
     135select distinct c.category_id, c.category_name,
     136case when tabela.naracan_proizvod >= 1 then tabela.naracan_proizvod else 0 end as naracani_proizvodi
     137from category as c
     138join product as p on p.category_id=c2.category_id
     139join product_in_store as pis on p.product_id=pis.product_id
     140join orders as o on o.product_in_store_id=pis.product_in_store_id
     141join(
     142        select distinct c2.category_id, c2.category_name, count(o.product_in_store_id) as naracan_proizvod
     143        from category as c2
     144        join product as p on p.category_id=c2.category_id
     145        join product_in_store as pis on p.product_id=pis.product_id
     146        join orders as o on o.product_in_store_id=pis.product_in_store_id
     147        group by 1, 2
     148) as tabela on c.category_id=tabela.category_id
     149}}}
     150