197 | | === Извештај за деловите кои биле нарачани во последните 3 месеци, со нивни категории и производители и количината која била нарачана === |
198 | | |
199 | | {{{#!sql |
200 | | select p.id_part, p.part_name, cat.category_name, pm.pm_name, |
201 | | sum(ocp.quantity_order) as narachani_posledni_3_meseci |
202 | | from project.part as p |
203 | | join project.part_manufacturer as pm on p.id_part_manufacturer = pm.id_part_manufacturer |
204 | | join project.part_is_from_category as pifc on p.id_part = pifc.id_part |
205 | | join project.category as cat on pifc.id_category = cat.id_category |
206 | | join project.order_contains_part as ocp on p.id_part = ocp.id_part |
207 | | join project.order_table as o on ocp.id_order = o.id_order |
208 | | and |
209 | | o.order_date between now()-interval'3 months' and now() |
210 | | group by p.id_part, p.part_name, cat.category_name, pm.pm_name |
211 | | }}} |
212 | | |
| 212 | === Извештај за деловите кои биле нарачани во последните 3 месеци, со нивни категории и производители и количината која била нарачана === |
| 213 | |
| 214 | {{{#!sql |
| 215 | select p.id_part, p.part_name, cat.category_name, pm.pm_name, |
| 216 | sum(ocp.quantity_order) as narachani_posledni_3_meseci |
| 217 | from project.part as p |
| 218 | join project.part_manufacturer as pm on p.id_part_manufacturer = pm.id_part_manufacturer |
| 219 | join project.part_is_from_category as pifc on p.id_part = pifc.id_part |
| 220 | join project.category as cat on pifc.id_category = cat.id_category |
| 221 | join project.order_contains_part as ocp on p.id_part = ocp.id_part |
| 222 | join project.order_table as o on ocp.id_order = o.id_order |
| 223 | and |
| 224 | o.order_date between now()-interval'3 months' and now() |
| 225 | group by p.id_part, p.part_name, cat.category_name, pm.pm_name |
| 226 | }}} |
| 227 | |