q87.sql 1.1 KB

1234567891011121314151617181920212223242526
  1. --!syntax_pg
  2. --TPC-DS Q87
  3. -- start query 1 in stream 0 using template ../query_templates/query87.tpl
  4. select count(*)
  5. from ((select distinct c_last_name, c_first_name, d_date
  6. from plato.store_sales, plato.date_dim, plato.customer
  7. where store_sales.ss_sold_date_sk = date_dim.d_date_sk
  8. and store_sales.ss_customer_sk = customer.c_customer_sk
  9. and d_month_seq between 1212 and 1212+11)
  10. except
  11. (select distinct c_last_name, c_first_name, d_date
  12. from plato.catalog_sales, plato.date_dim, plato.customer
  13. where catalog_sales.cs_sold_date_sk = date_dim.d_date_sk
  14. and catalog_sales.cs_bill_customer_sk = customer.c_customer_sk
  15. and d_month_seq between 1212 and 1212+11)
  16. except
  17. (select distinct c_last_name, c_first_name, d_date
  18. from plato.web_sales, plato.date_dim, plato.customer
  19. where web_sales.ws_sold_date_sk = date_dim.d_date_sk
  20. and web_sales.ws_bill_customer_sk = customer.c_customer_sk
  21. and d_month_seq between 1212 and 1212+11)
  22. ) cool_cust
  23. ;
  24. -- end query 1 in stream 0 using template ../query_templates/query87.tpl