forked from agirish/tpcds
-
Notifications
You must be signed in to change notification settings - Fork 0
/
query43.sql
50 lines (50 loc) · 1.68 KB
/
query43.sql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
-- start query 43 in stream 0 using template query43.tpl
SELECT s_store_name,
s_store_id,
Sum(CASE
WHEN ( d_day_name = 'Sunday' ) THEN ss_sales_price
ELSE NULL
END) sun_sales,
Sum(CASE
WHEN ( d_day_name = 'Monday' ) THEN ss_sales_price
ELSE NULL
END) mon_sales,
Sum(CASE
WHEN ( d_day_name = 'Tuesday' ) THEN ss_sales_price
ELSE NULL
END) tue_sales,
Sum(CASE
WHEN ( d_day_name = 'Wednesday' ) THEN ss_sales_price
ELSE NULL
END) wed_sales,
Sum(CASE
WHEN ( d_day_name = 'Thursday' ) THEN ss_sales_price
ELSE NULL
END) thu_sales,
Sum(CASE
WHEN ( d_day_name = 'Friday' ) THEN ss_sales_price
ELSE NULL
END) fri_sales,
Sum(CASE
WHEN ( d_day_name = 'Saturday' ) THEN ss_sales_price
ELSE NULL
END) sat_sales
FROM date_dim,
store_sales,
store
WHERE d_date_sk = ss_sold_date_sk
AND s_store_sk = ss_store_sk
AND s_gmt_offset = -5
AND d_year = 2002
GROUP BY s_store_name,
s_store_id
ORDER BY s_store_name,
s_store_id,
sun_sales,
mon_sales,
tue_sales,
wed_sales,
thu_sales,
fri_sales,
sat_sales
LIMIT 100;