query3.sql 581 B

123456789101112131415161718192021
  1. -- start query 1 in stream 0 using template query3.tpl and seed 2031708268
  2. select dt.d_year
  3. ,item.i_brand_id brand_id
  4. ,item.i_brand brand
  5. ,sum(ss_sales_price) sum_agg
  6. from date_dim dt
  7. ,store_sales
  8. ,item
  9. where dt.d_date_sk = store_sales.ss_sold_date_sk
  10. and store_sales.ss_item_sk = item.i_item_sk
  11. and item.i_manufact_id = 816
  12. and dt.d_moy=11
  13. group by dt.d_year
  14. ,item.i_brand
  15. ,item.i_brand_id
  16. order by dt.d_year
  17. ,sum_agg desc
  18. ,brand_id
  19. limit 100;
  20. -- end query 1 in stream 0 using template query3.tpl