Changes between Version 24 and Version 25 of Напредни извештаи од базата
- Timestamp:
- 02/13/22 21:13:58 (3 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Напредни извештаи од базата
v24 v25 34 34 == 5 Најпопуларни производи во изминатите 6 месеци == 35 35 {{{#!sql 36 select distinct p. "name" as Name, p.description as description,cnt36 select distinct p.prod_id, count(cp.prod_id) as cnt 37 37 from 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 38 join project.contains_product as cp on cp.prod_id = p.prod_id 39 join project.cart as crt on crt.cart_id = cp.cart_id 46 40 join project.checkout as chk on chk.cart_id = crt.cart_id 47 41 join project.order as o on o.order_id = chk.order_id 48 42 join project.delivery as dlv on o.delivery_id = dlv.delivery_id 49 43 where dlv.status = 'Delivered' and now()-interval'6 months' <= dlv."date" 44 group by p.prod_id,cp.prod_id 50 45 order by cnt desc 51 46 limit 5;