github.com/apache/beam/sdks/v2@v2.48.2/java/testing/tpcds/src/main/resources/queries/query62.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 18 substring(w_warehouse_name,1,20) 19 ,sm_type 20 ,web_name 21 ,sum(case when (ws_ship_date_sk - ws_sold_date_sk <= 30 ) then 1 else 0 end) as `30 days` 22 ,sum(case when (ws_ship_date_sk - ws_sold_date_sk > 30) and 23 (ws_ship_date_sk - ws_sold_date_sk <= 60) then 1 else 0 end ) as `31-60 days` 24 ,sum(case when (ws_ship_date_sk - ws_sold_date_sk > 60) and 25 (ws_ship_date_sk - ws_sold_date_sk <= 90) then 1 else 0 end) as `61-90 days` 26 ,sum(case when (ws_ship_date_sk - ws_sold_date_sk > 90) and 27 (ws_ship_date_sk - ws_sold_date_sk <= 120) then 1 else 0 end) as `91-120 days` 28 ,sum(case when (ws_ship_date_sk - ws_sold_date_sk > 120) then 1 else 0 end) as `>120 days` 29 from 30 web_sales 31 ,warehouse 32 ,ship_mode 33 ,web_site 34 ,date_dim 35 where 36 d_month_seq between 1212 and 1212 + 11 37 and ws_ship_date_sk = d_date_sk 38 and ws_warehouse_sk = w_warehouse_sk 39 and ws_ship_mode_sk = sm_ship_mode_sk 40 and ws_web_site_sk = web_site_sk 41 group by 42 substring(w_warehouse_name,1,20) 43 ,sm_type 44 ,web_name 45 order by substring(w_warehouse_name,1,20) 46 ,sm_type 47 ,web_name 48 limit 100