回答編集履歴

2

間違い修正

2018/03/12 04:10

投稿

sousuke
sousuke

スコア3828

test CHANGED
@@ -48,10 +48,14 @@
48
48
 
49
49
  where B.ユーザーID=A.ユーザーID
50
50
 
51
- and B.日付カラム<dateadd(month,-3,A.日付カラム)),0) as フラグ
51
+ and B.日付カラム between dateadd(month,-3,A.日付カラム) and A.日付カラム-1),0) as フラグ
52
52
 
53
53
  from ポイント履歴 as A
54
54
 
55
55
  ```
56
56
 
57
57
  dateaddとかcoalesceはデータベースに合わせてください。
58
+
59
+
60
+
61
+ 間違ってたのでSQL修正追記しました。

1

誤字修正

2018/03/12 04:10

投稿

sousuke
sousuke

スコア3828

test CHANGED
@@ -48,7 +48,7 @@
48
48
 
49
49
  where B.ユーザーID=A.ユーザーID
50
50
 
51
- and B.日付カラム<dateadd(month,-1,A.日付カラム)),0) as フラグ
51
+ and B.日付カラム<dateadd(month,-3,A.日付カラム)),0) as フラグ
52
52
 
53
53
  from ポイント履歴 as A
54
54