ソースコード
WITH uri_2023_01 AS (
	SELECT  
		SUM(SALES_AMT) as S
	FROM SALES

	WHERE 
		UPDATED_NO IS NULL
		AND SALES_DATE BETWEEN '2023-01-01' AND '2023-01-31'
),
uri_2023_02 AS (
	SELECT  
		SUM(SALES_AMT) as S
	FROM SALES

	WHERE 
		UPDATED_NO IS NULL
		AND SALES_DATE BETWEEN '2023-02-01' AND '2023-02-28'
),
uri_2023_03 AS (
	SELECT  
		SUM(SALES_AMT) as S
	FROM SALES

	WHERE 
		UPDATED_NO IS NULL
		AND SALES_DATE BETWEEN '2023-03-01' AND '2023-03-31'
),
uri_2023_04 AS (
	SELECT  
		SUM(SALES_AMT) as S
	FROM SALES

	WHERE 
		UPDATED_NO IS NULL
		AND SALES_DATE BETWEEN '2023-04-01' AND '2023-04-30'
),
uri_2023_05 AS (
	SELECT  
		SUM(SALES_AMT) as S
	FROM SALES

	WHERE 
		UPDATED_NO IS NULL
		AND SALES_DATE BETWEEN '2023-05-01' AND '2023-05-31'
),
uri_2023_06 AS (
	SELECT  
		SUM(SALES_AMT) as S
	FROM SALES

	WHERE 
		UPDATED_NO IS NULL
		AND SALES_DATE BETWEEN '2023-06-01' AND '2023-06-30'
),
uri_2023_07 AS (
	SELECT  
		SUM(SALES_AMT) as S
	FROM SALES

	WHERE 
		UPDATED_NO IS NULL
		AND SALES_DATE BETWEEN '2023-07-01' AND '2023-07-31'
),
uri_2023_08 AS (
	SELECT  
		SUM(SALES_AMT) as S
	FROM SALES

	WHERE 
		UPDATED_NO IS NULL
		AND SALES_DATE BETWEEN '2023-08-01' AND '2023-08-31'
),
uri_2023_09 AS (
	SELECT  
		SUM(SALES_AMT) as S
	FROM SALES

	WHERE 
		UPDATED_NO IS NULL
		AND SALES_DATE BETWEEN '2023-09-01' AND '2023-09-30'
),
uri_2023_10 AS (
	SELECT  
		SUM(SALES_AMT) as S
	FROM SALES

	WHERE 
		UPDATED_NO IS NULL
		AND SALES_DATE BETWEEN '2023-10-01' AND '2023-10-31'
),
uri_2023_11 AS (
	SELECT  
		SUM(SALES_AMT) as S
	FROM SALES

	WHERE 
		UPDATED_NO IS NULL
		AND SALES_DATE BETWEEN '2023-11-01' AND '2023-11-30'
),
uri_2023_12 AS (
	SELECT  
		SUM(SALES_AMT)  as S
	FROM SALES

	WHERE 
		UPDATED_NO IS NULL
		AND SALES_DATE BETWEEN '2023-12-01' AND '2023-12-31'
),
uri_2023 AS (
	SELECT  
		SUM(S)
	FROM 
		(select * FROM uri_2023_01 
		union select * FROM uri_2023_02
		union select * FROM uri_2023_03
		union select * FROM uri_2023_04
		union select * FROM uri_2023_05
		union select * FROM uri_2023_06
		union select * FROM uri_2023_07
		union select * FROM uri_2023_08
		union select * FROM uri_2023_09
		union select * FROM uri_2023_10
		union select * FROM uri_2023_11
		union select * FROM uri_2023_12
		)

)



SELECT 
	*
FROM uri_2023
;
提出情報
提出日時2024/02/19 08:46:49
コンテスト第11回 SQLコンテスト
問題Zチャート
受験者Hodgepodge
状態 (詳細)WA
(Wrong Answer: 誤答)
メモリ使用量85 MB
メッセージ
テストケース(通過数/総数)
0/2
状態
メモリ使用量
データパターン1
WA
84 MB
データパターン2
WA
85 MB