github.com/apache/beam/sdks/v2@v2.48.2/java/testing/tpcds/src/main/resources/queries/query68.sql (about) 1 -- Licensed to the Apache Software Foundation (ASF) under one 2 -- or more contributor license agreements. See the NOTICE file 3 -- distributed with this work for additional information 4 -- regarding copyright ownership. The ASF licenses this file 5 -- to you under the Apache License, Version 2.0 (the 6 -- "License"); you may not use this file except in compliance 7 -- with the License. You may obtain a copy of the License at 8 -- 9 -- http://www.apache.org/licenses/LICENSE-2.0 10 -- 11 -- Unless required by applicable law or agreed to in writing, software 12 -- distributed under the License is distributed on an "AS IS" BASIS, 13 -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 -- See the License for the specific language governing permissions and 15 -- limitations under the License. 16 17 select c_last_name 18 ,c_first_name 19 ,ca_city 20 ,bought_city 21 ,ss_ticket_number 22 ,extended_price 23 ,extended_tax 24 ,list_price 25 from (select ss_ticket_number 26 ,ss_customer_sk 27 ,ca_city bought_city 28 ,sum(ss_ext_sales_price) extended_price 29 ,sum(ss_ext_list_price) list_price 30 ,sum(ss_ext_tax) extended_tax 31 from store_sales 32 ,date_dim 33 ,store 34 ,household_demographics 35 ,customer_address 36 where store_sales.ss_sold_date_sk = date_dim.d_date_sk 37 and store_sales.ss_store_sk = store.s_store_sk 38 and store_sales.ss_hdemo_sk = household_demographics.hd_demo_sk 39 and store_sales.ss_addr_sk = customer_address.ca_address_sk 40 and date_dim.d_dom between 1 and 2 41 and (household_demographics.hd_dep_count = 5 or 42 household_demographics.hd_vehicle_count= 3) 43 and date_dim.d_year in (1999,1999+1,1999+2) 44 and store.s_city in ('Midway','Fairview') 45 group by ss_ticket_number 46 ,ss_customer_sk 47 ,ss_addr_sk,ca_city) dn 48 ,customer 49 ,customer_address current_addr 50 where ss_customer_sk = c_customer_sk 51 and customer.c_current_addr_sk = current_addr.ca_address_sk 52 and current_addr.ca_city <> bought_city 53 order by c_last_name 54 ,ss_ticket_number 55 limit 100