回答編集履歴

1

回答追記

2017/02/22 00:21

投稿

Y.H.
Y.H.

スコア7914

test CHANGED
@@ -1,11 +1,35 @@
1
+ 「2015年2月以降のデータを取得」と例のSQLの条件(`SUBSTR(test_ymd,1,6)> '201502'`と2015年02月より大きいなので2015/03/01以降)が合いませんが。
2
+
3
+
4
+
1
5
  関数使わないとしたら以下しかないと思います。
2
6
 
3
7
 
4
8
 
5
9
  ```SQL
6
10
 
11
+ -- 2015/03/01以降なら
12
+
7
13
  select * from Table01 where test_ymd > '20150228';
14
+
15
+ select * from Table01 where test_ymd >= '201503';
16
+
17
+ select * from Table01 where test_ymd >= '20150300';
8
18
 
9
19
  select * from Table01 where test_ymd >= '20150301';
10
20
 
21
+ -- 2015/02/01以降なら
22
+
23
+ select * from Table01 where test_ymd > '20150131';
24
+
25
+ select * from Table01 where test_ymd > '201502';
26
+
27
+ select * from Table01 where test_ymd > '20150200';
28
+
29
+ select * from Table01 where test_ymd >= '20150201';
30
+
11
31
  ```
32
+
33
+
34
+
35
+