回答編集履歴
3
変更
answer
CHANGED
@@ -14,8 +14,7 @@
|
|
14
14
|
|
15
15
|
select sum_year, sum_date, user_cnt from t_hoge
|
16
16
|
where sum_year between to_char('2014-04-01'::date,'YYYY')::numeric and to_char((date '2014-04-01' +interval '3 month'),'YYYY')::numeric
|
17
|
-
and not (sum_year = to_char('2014-04-01'::date,'YYYY')::numeric and sum_monthly
|
17
|
+
and not (sum_year = to_char('2014-04-01'::date,'YYYY')::numeric and sum_monthly < substr('2014-04-01',6,2)::numeric)
|
18
|
-
and not (sum_year = to_char((date '2014-04-01' +interval '3 month'),'YYYY')::numeric
|
19
|
-
|
18
|
+
and not (sum_year = to_char((date '2014-04-01' +interval '3 month'),'YYYY')::numeric and sum_monthly >= to_char((date '2014-04-01' +interval '3 month'),'mm')::numeric)
|
20
|
-
and sum_day
|
19
|
+
and sum_day = substr('2014-04-01',9,2)::numeric;
|
21
20
|
```
|
2
変更
answer
CHANGED
@@ -14,8 +14,8 @@
|
|
14
14
|
|
15
15
|
select sum_year, sum_date, user_cnt from t_hoge
|
16
16
|
where sum_year between to_char('2014-04-01'::date,'YYYY')::numeric and to_char((date '2014-04-01' +interval '3 month'),'YYYY')::numeric
|
17
|
+
and not (sum_year = to_char('2014-04-01'::date,'YYYY')::numeric and sum_monthly > 1 and sum_monthly < substr('2014-04-01',6,2)::numeric)
|
17
|
-
and
|
18
|
+
and not (sum_year = to_char((date '2014-04-01' +interval '3 month'),'YYYY')::numeric
|
18
|
-
and
|
19
|
+
and sum_monthly < 12 and sum_monthly >= to_char((date '2014-04-01' +interval '3 month'),'mm')::numeric)
|
19
20
|
and sum_day = substr('2014-04-01',9,2)::numeric;
|
20
|
-
|
21
21
|
```
|
1
変更
answer
CHANGED
@@ -15,7 +15,7 @@
|
|
15
15
|
select sum_year, sum_date, user_cnt from t_hoge
|
16
16
|
where sum_year between to_char('2014-04-01'::date,'YYYY')::numeric and to_char((date '2014-04-01' +interval '3 month'),'YYYY')::numeric
|
17
17
|
and sum_monthly between substr('2014-04-01',6,2)::numeric and 12
|
18
|
-
and sum_monthly > 1 and sum_monthly < to_char((date '2014-04-01' +interval '3 month'),'mm')::numeric
|
18
|
+
and sum_monthly >= 1 and sum_monthly < to_char((date '2014-04-01' +interval '3 month'),'mm')::numeric
|
19
19
|
and sum_day = substr('2014-04-01',9,2)::numeric;
|
20
20
|
|
21
21
|
```
|