q03.sql 647 B

123456789101112131415161718192021222324
  1. --!syntax_pg
  2. --TPC-DS Q3
  3. -- start query 1 in stream 0 using template ../query_templates/query3.tpl
  4. select dt.d_year
  5. ,item.i_brand_id brand_id
  6. ,item.i_brand brand
  7. ,sum(ss_ext_sales_price) sum_agg
  8. from plato.date_dim dt
  9. ,plato.store_sales
  10. ,plato.item
  11. where dt.d_date_sk = store_sales.ss_sold_date_sk
  12. and store_sales.ss_item_sk = item.i_item_sk
  13. and item.i_manufact_id = 436
  14. and dt.d_moy=12
  15. group by dt.d_year
  16. ,item.i_brand
  17. ,item.i_brand_id
  18. order by dt.d_year
  19. ,sum_agg desc
  20. ,brand_id
  21. limit 100;
  22. -- end query 1 in stream 0 using template ../query_templates/query3.tpl