Changes between Version 16 and Version 17 of Напредни извештаи од базата


Ignore:
Timestamp:
02/13/22 14:11:35 (3 years ago)
Author:
186102
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Напредни извештаи од базата

    v16 v17  
     1== Вкупен приџод по продавница во изминатите 3 месеци==
     2{{{#!sql
     3select sum(t1.Anhoch+t2.Anhoch) as Anhoch, sum(t1.Setec + t2.Setec) as Setec, sum(t1.Neptun+t2.Neptun) as Neptun
     4from
     5(
     6select
     7sum(case when pr.store_name = 'Anhoch' then cp.quantity * pr.price else 0 end) as Anhoch,
     8sum(case when pr.store_name = 'Setec' then cp.quantity * pr.price else 0 end) as Setec,
     9sum(case when pr.store_name = 'Neptun' then cp.quantity * pr.price else 0 end) as Neptun
     10from project.order as o
     11join project.checkout as ch on o.order_id = ch.order_id
     12join project.cart as cr on cr.cart_id = ch.cart_id
     13join project.contains_product as cp on cp.cart_id = cr.cart_id
     14join project.product as pr on pr.prod_id = cp.prod_id
     15join project.store as str on pr.store_name = str.store_name
     16join project.delivery as dlv on dlv.delivery_id = o.delivery_id
     17where now() - interval '3 months' <= dlv."date"
     18) as t1,
     19(
     20select
     21sum(case when pr.store_name = 'Anhoch' then ccp.num_products_config * pr.price else 0 end) as Anhoch,
     22sum(case when pr.store_name = 'Setec' then ccp.num_products_config * pr.price else 0 end) as Setec,
     23sum(case when pr.store_name = 'Neptun' then ccp.num_products_config * pr.price else 0 end) as Neptun
     24from project.order as o
     25join project.orders_configuration as oc on o.order_id = oc.order_id
     26join project."Configuration" as cfg on oc.config_id = cfg.config_id
     27join project.config_contains_product as ccp on cfg.config_id = ccp.config_id
     28join project.product as pr on pr.prod_id = ccp.prod_id
     29join project.store as str on pr.store_name = str.store_name
     30join project.delivery as dlv on dlv.delivery_id = o.delivery_id
     31where now() - interval '3 months' <= dlv."date"
     32) as t2
     33}}}
     34
    135== Просечна цена на продуктот во месец од изминатите 12 месеци ==
    236{{{#!sql