回答編集履歴

2

追加

2018/02/16 10:56

投稿

A.Ichi
A.Ichi

スコア4070

test CHANGED
@@ -7,3 +7,39 @@
7
7
  select count(case when id='4' then id else null end), count(case when id='7' then id else null end) from user where status=1;
8
8
 
9
9
  ```
10
+
11
+
12
+
13
+
14
+
15
+ ```sql
16
+
17
+ create temp table Auser (id varchar, status int);
18
+
19
+ insert into auser values ('4',1),('4',1),('4',1),('7',1),
20
+
21
+ ('4',1),('4',1),('4',1),('7',1),
22
+
23
+ ('4',1),('4',1),('4',1),('7',1),
24
+
25
+ ('4',1),('4',1),('4',1),('7',1),
26
+
27
+ ('4',1),('4',1),('4',1),('7',0),
28
+
29
+ ('5',1),('5',1),('5',1),('7',0);
30
+
31
+ INSERT 0 24
32
+
33
+
34
+
35
+ select count(case when id='4' then id else null end), count(case when id='7' then id else null end) from Auser where status=1;
36
+
37
+ count | count
38
+
39
+ -------+-------
40
+
41
+ 15 | 4
42
+
43
+ ```
44
+
45
+ これでテストしたつもり

1

追加

2018/02/16 10:56

投稿

A.Ichi
A.Ichi

スコア4070

test CHANGED
File without changes