1
0

query71.sql 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. -- start query 1 in stream 0 using template query71.tpl and seed 2031708268
  2. select i_brand_id brand_id, i_brand brand,t_hour,t_minute,
  3. sum(ext_price) ext_price
  4. from item, (select ws_ext_sales_price as ext_price,
  5. ws_sold_date_sk as sold_date_sk,
  6. ws_item_sk as sold_item_sk,
  7. ws_sold_time_sk as time_sk
  8. from web_sales,date_dim
  9. where d_date_sk = ws_sold_date_sk
  10. and d_moy=12
  11. and d_year=2000
  12. union all
  13. select cs_ext_sales_price as ext_price,
  14. cs_sold_date_sk as sold_date_sk,
  15. cs_item_sk as sold_item_sk,
  16. cs_sold_time_sk as time_sk
  17. from catalog_sales,date_dim
  18. where d_date_sk = cs_sold_date_sk
  19. and d_moy=12
  20. and d_year=2000
  21. union all
  22. select ss_ext_sales_price as ext_price,
  23. ss_sold_date_sk as sold_date_sk,
  24. ss_item_sk as sold_item_sk,
  25. ss_sold_time_sk as time_sk
  26. from store_sales,date_dim
  27. where d_date_sk = ss_sold_date_sk
  28. and d_moy=12
  29. and d_year=2000
  30. ) tmp,time_dim
  31. where
  32. sold_item_sk = i_item_sk
  33. and i_manager_id=1
  34. and time_sk = t_time_sk
  35. and (t_meal_time = 'breakfast' or t_meal_time = 'dinner')
  36. group by i_brand, i_brand_id,t_hour,t_minute
  37. order by ext_price desc, i_brand_id
  38. ;
  39. -- end query 1 in stream 0 using template query71.tpl