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


Ignore:
Timestamp:
02/13/22 21:13:58 (3 years ago)
Author:
186102
Comment:

--

Legend:

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

    v24 v25  
    3434== 5 Најпопуларни производи во изминатите 6 месеци ==
    3535{{{#!sql
    36 select distinct p."name" as Name, p.description as description, cnt
     36select distinct p.prod_id, count(cp.prod_id) as cnt
    3737from project.product as p
    38 join
    39 (
    40         select cp.prod_id, count(cp.prod_id) as cnt
    41         from project.contains_product as cp
    42         group by cp.prod_id
    43 )as t1 on t1.prod_id = p.prod_id
    44 join project.contains_product as ccp on ccp.prod_id = p.prod_id
    45 join project.cart as crt on crt.cart_id = ccp.cart_id
     38join project.contains_product as cp on cp.prod_id = p.prod_id
     39join project.cart as crt on crt.cart_id = cp.cart_id
    4640join project.checkout as chk on chk.cart_id = crt.cart_id
    4741join project.order as o on o.order_id = chk.order_id
    4842join project.delivery as dlv on o.delivery_id = dlv.delivery_id
    4943where dlv.status = 'Delivered' and now()-interval'6 months' <= dlv."date"
     44group by p.prod_id,cp.prod_id
    5045order by cnt desc
    5146limit 5;