query52.sql 444 B

12345678910111213141516171819202122
  1. select dt.d_year
  2. ,item.i_brand_id brand_id
  3. ,item.i_brand brand
  4. ,sum(ss_ext_sales_price) ext_price
  5. from date_dim dt
  6. ,store_sales
  7. ,item
  8. where dt.d_date_sk = store_sales.ss_sold_date_sk
  9. and store_sales.ss_item_sk = item.i_item_sk
  10. and item.i_manager_id = 1
  11. and dt.d_moy=12
  12. and dt.d_year=1998
  13. group by dt.d_year
  14. ,item.i_brand
  15. ,item.i_brand_id
  16. order by dt.d_year
  17. ,ext_price desc
  18. ,brand_id
  19. limit 100 ;