回答編集履歴

2

推敲

2020/06/12 08:02

投稿

sazi
sazi

スコア25199

test CHANGED
@@ -3,6 +3,10 @@
3
3
 
4
4
 
5
5
  直近の有効な値を求める対象のデータを判別しておく必要があります。
6
+
7
+ 結果lag()は使用しません。
8
+
9
+ ※with部分はテーブルの疑似データです。実際のデータを使用する場合は不要です。
6
10
 
7
11
  ```SQL
8
12
 

1

推敲

2020/06/12 08:02

投稿

sazi
sazi

スコア25199

test CHANGED
@@ -40,11 +40,11 @@
40
40
 
41
41
  select t1.*
42
42
 
43
- ,(select max(survey_date)
43
+ ,(select max(survey_date)
44
44
 
45
- from test_table2
45
+ from test_table2
46
46
 
47
- where cig_code_curr is not null and survey_date <= t1.survey_date
47
+ where cig_code_curr is not null and survey_date <= t1.survey_date
48
48
 
49
49
  ) as valid_survey_date
50
50