Changes between Version 7 and Version 8 of AdvancedReports
- Timestamp:
- 12/27/22 21:22:06 (3 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
AdvancedReports
v7 v8 112 112 113 113 {{{#!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 s114 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 115 115 left join users u on u.userid=s.userid 116 116 left join orders o on o.supplieruserid=s.userid and (o.status='Delivered' or o.status='Processed') … … 118 118 group by s.userid, u.userid 119 119 order by zarabotkasupp desc 120 }}} 120 121 122 === Извештај за најпопуларен артикл по категорија === 121 123 124 {{{#!sql 125 select 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 122 140 }}}
