質問編集履歴
5
aaaaaa
test
CHANGED
@@ -1 +1 @@
|
|
1
|
-
MySQLでのSELECTした
|
1
|
+
MySQLでのSELECTで名前変更したものをを検索する方法。
|
test
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
|
4
4
|
|
5
|
-
SQLでSELECTで変更した値を検索したい。
|
5
|
+
SQLでSELECTで名前を変更した値を検索したい。
|
6
6
|
|
7
7
|
|
8
8
|
|
@@ -26,9 +26,9 @@
|
|
26
26
|
|
27
27
|
ELSE 99
|
28
28
|
|
29
|
-
END as gender
|
29
|
+
END as gender1
|
30
30
|
|
31
|
-
FROM users where gender = 2
|
31
|
+
FROM users where gender1 = 2
|
32
32
|
|
33
33
|
|
34
34
|
|
@@ -40,11 +40,11 @@
|
|
40
40
|
|
41
41
|
gender
|
42
42
|
|
43
|
-
) gender
|
43
|
+
) gender1
|
44
44
|
|
45
45
|
FROM users
|
46
46
|
|
47
|
-
where gender = 2;
|
47
|
+
where gender1 = 2;
|
48
48
|
|
49
49
|
|
50
50
|
|
@@ -119,3 +119,27 @@
|
|
119
119
|
|
120
120
|
|
121
121
|
### ご教授ください。
|
122
|
+
|
123
|
+
|
124
|
+
|
125
|
+
|
126
|
+
|
127
|
+
|
128
|
+
|
129
|
+
### 追記
|
130
|
+
|
131
|
+
|
132
|
+
|
133
|
+
```
|
134
|
+
|
135
|
+
SELECT
|
136
|
+
|
137
|
+
gender as g1
|
138
|
+
|
139
|
+
FROM users
|
140
|
+
|
141
|
+
where g1 is null;
|
142
|
+
|
143
|
+
|
144
|
+
|
145
|
+
```
|
4
あああああ
test
CHANGED
File without changes
|
test
CHANGED
@@ -100,4 +100,22 @@
|
|
100
100
|
|
101
101
|
|
102
102
|
|
103
|
+
# 期待値
|
104
|
+
|
105
|
+
|id|gender|
|
106
|
+
|
107
|
+
|:--|:--:|
|
108
|
+
|
109
|
+
|11|null|
|
110
|
+
|
111
|
+
|12|null|
|
112
|
+
|
113
|
+
|13|null|
|
114
|
+
|
115
|
+
|14|null|
|
116
|
+
|
117
|
+
|15|null|
|
118
|
+
|
119
|
+
|
120
|
+
|
103
121
|
### ご教授ください。
|
3
SELECT IF( gender = null, gender = 2, gender ) gender FROM users where gender = 2;
test
CHANGED
File without changes
|
test
CHANGED
@@ -29,6 +29,22 @@
|
|
29
29
|
END as gender
|
30
30
|
|
31
31
|
FROM users where gender = 2
|
32
|
+
|
33
|
+
|
34
|
+
|
35
|
+
SELECT
|
36
|
+
|
37
|
+
IF(
|
38
|
+
|
39
|
+
gender = null, gender = 2,
|
40
|
+
|
41
|
+
gender
|
42
|
+
|
43
|
+
) gender
|
44
|
+
|
45
|
+
FROM users
|
46
|
+
|
47
|
+
where gender = 2;
|
32
48
|
|
33
49
|
|
34
50
|
|
2
MySQL
test
CHANGED
@@ -1 +1 @@
|
|
1
|
-
SQLでのSELECTした値を検索する方法。
|
1
|
+
MySQLでのSELECTした値を検索する方法。
|
test
CHANGED
File without changes
|
1
sssss
test
CHANGED
File without changes
|
test
CHANGED
@@ -28,7 +28,7 @@
|
|
28
28
|
|
29
29
|
END as gender
|
30
30
|
|
31
|
-
FROM user where gender = 2
|
31
|
+
FROM users where gender = 2
|
32
32
|
|
33
33
|
|
34
34
|
|