query91.sql 1.2 KB

12345678910111213141516171819202122232425262728293031
  1. -- start query 1 in stream 0 using template query91.tpl and seed 1930872976
  2. select
  3. cc_call_center_id Call_Center,
  4. cc_name Call_Center_Name,
  5. cc_manager Manager,
  6. sum(cr_net_loss) Returns_Loss
  7. from
  8. call_center,
  9. catalog_returns,
  10. date_dim,
  11. customer,
  12. customer_address,
  13. customer_demographics,
  14. household_demographics
  15. where
  16. cr_call_center_sk = cc_call_center_sk
  17. and cr_returned_date_sk = d_date_sk
  18. and cr_returning_customer_sk= c_customer_sk
  19. and cd_demo_sk = c_current_cdemo_sk
  20. and hd_demo_sk = c_current_hdemo_sk
  21. and ca_address_sk = c_current_addr_sk
  22. and d_year = 2000
  23. and d_moy = 12
  24. and ( (cd_marital_status = 'M' and cd_education_status = 'Unknown')
  25. or(cd_marital_status = 'W' and cd_education_status = 'Advanced Degree'))
  26. and hd_buy_potential like 'Unknown%'
  27. and ca_gmt_offset = -7
  28. group by cc_call_center_id,cc_name,cc_manager,cd_marital_status,cd_education_status
  29. order by sum(cr_net_loss) desc;
  30. -- end query 1 in stream 0 using template query91.tpl