Changes between Version 7 and Version 8 of AdvancedReports


Ignore:
Timestamp:
12/27/22 21:22:06 (2 years ago)
Author:
201065
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • AdvancedReports

    v7 v8  
    112112
    113113{{{#!sql
    114         select s.supplierinfo, u.firstname, u.lastname, u.username, coalesce(sum(o2.quantity), 0) as koldostavena, coalesce(sum(o2.quantity*o2.price)) as zarabotkasupp from suppliers s
     114select s.supplierinfo, u.firstname, u.lastname, u.username, coalesce(sum(o2.quantity), 0) as koldostavena, coalesce(sum(o2.quantity*o2.price)) as zarabotkasupp from suppliers s
    115115                left join users u on u.userid=s.userid
    116116                left join orders o on o.supplieruserid=s.userid and (o.status='Delivered' or o.status='Processed')
     
    118118                group by s.userid, u.userid
    119119                order by zarabotkasupp desc
     120}}}
    120121
     122===  Извештај за најпопуларен артикл по категорија ===
    121123
     124{{{#!sql
     125select c2.categoryname,
     126(select a.articlename from articles a
     127        left join invoicedarticles i on i.articleid=a.articleid
     128        left join article_belongs_to_category abtc on abtc.articleid=a.articleid
     129        where abtc.categoryid = c2.categoryid
     130        group by a.articleid
     131        having coalesce(sum(i.quantity),0)=max(q1.vkolicina) limit 1),
     132        max(q1.vkolicina) as vkolicinia from categories c2
     133                left join(
     134                        select c.categoryid, c.categoryname, articlename, (coalesce(sum(i.quantity),0)) as vkolicina from categories c
     135                        left join article_belongs_to_category abtc on abtc.categoryid=c.categoryid
     136                        left join articles a on a.articleid=abtc.articleid
     137                        left join invoicedarticles i on i.articleid=a.articleid
     138                        group by c.categoryid, a.articleid ) q1 on q1.categoryid=c2.categoryid
     139        group by c2.categoryid
    122140}}}