質問するログイン新規登録

回答編集履歴

1

修正

2017/08/23 07:33

投稿

A.Ichi
A.Ichi

スコア4070

answer CHANGED
@@ -3,7 +3,7 @@
3
3
  select tb1.f1, sum(tb2.zan) from
4
4
  (select distinct f1 from hoge where f1 between '2017/01' and '2017/03') tb1
5
5
  cross join
6
- ( select f1, 1 zan from hoge where f2 is null or f1<>f2
6
+ ( select f1, 1 zan from hoge where f2 is null or f1!=f2
7
7
  union all
8
8
  select f2, -1 zan from hoge where f2 is not null) tb2
9
9
  where tb1.f1 >= tb2.f1