q45.sql 892 B

1234567891011121314151617181920212223
  1. --!syntax_pg
  2. --TPC-DS Q45
  3. -- start query 1 in stream 0 using template ../query_templates/query45.tpl
  4. select ca_zip, ca_county, sum(ws_sales_price)
  5. from plato.web_sales, plato.customer, plato.customer_address, plato.date_dim, plato.item
  6. where ws_bill_customer_sk = c_customer_sk
  7. and c_current_addr_sk = ca_address_sk
  8. and ws_item_sk = i_item_sk
  9. and ( substr(ca_zip,1,5) in ('85669', '86197','88274','83405','86475', '85392', '85460', '80348', '81792')
  10. or
  11. i_item_id in (select i_item_id
  12. from plato.item
  13. where i_item_sk in (2, 3, 5, 7, 11, 13, 17, 19, 23, 29)
  14. )
  15. )
  16. and ws_sold_date_sk = d_date_sk
  17. and d_qoy = 2 and d_year = 2000
  18. group by ca_zip, ca_county
  19. order by ca_zip, ca_county
  20. limit 100;
  21. -- end query 1 in stream 0 using template ../query_templates/query45.tpl