Changes between Version 2 and Version 3 of AdvancedReports


Ignore:
Timestamp:
02/03/24 19:31:10 (8 months ago)
Author:
201171
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • AdvancedReports

    v2 v3  
    1313group by product.product_name
    1414}}}
     15
     16=== Извештај за сите категории, нивните најмногу нарачани продукти и бројот на нарачки за продуктот
     17{{{
     18select
     19    category.category_name as Category,
     20    product.product_name as Product_Name,
     21    count(order_table_contains_product.product_id) as Number_of_orders
     22from
     23    category
     24join product_is_in_category on category.category_id = product_is_in_category.category_id
     25join product on product_is_in_category.product_id = product.product_id
     26join order_table_contains_product on product.product_id = order_table_contains_product.product_id
     27group by
     28    category.category_id,
     29    category.category_name,
     30    product.product_name
     31having
     32    count(order_table_contains_product.product_id) = (
     33        select
     34            count(*)
     35        from
     36            order_table_contains_product
     37        join product on order_table_contains_product.product_id = product.product_id
     38        join product_is_in_category on product.product_id = product_is_in_category.product_id
     39        where
     40            product_is_in_category.category_id = category.category_id
     41       group by
     42            order_table_contains_product.product_id
     43    )
     44}}}