query52.sql 502 B

1234567891011121314151617181920212223
  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. and ss_sold_date between '1998-12-01' and '1998-12-31'
  14. group by dt.d_year
  15. ,item.i_brand
  16. ,item.i_brand_id
  17. order by dt.d_year
  18. ,ext_price desc
  19. ,brand_id
  20. limit 100 ;