回答編集履歴
3
コメントを修正
answer
CHANGED
@@ -26,7 +26,7 @@
|
|
26
26
|
その辺も気にする場合は between でなく比較演算子を使うかもしれません、私だったら。
|
27
27
|
|
28
28
|
```sql
|
29
|
-
--
|
29
|
+
-- ミリ秒の扱いは分からないので仮
|
30
30
|
where targetdate between date(start_date || ' 00:00:00.000') and date(end_date || ' 23:59:59.999')
|
31
31
|
|
32
32
|
-- それだったらこっちですかね…? 日付の加算は分からないので仮
|
2
サンプルsqlを修正
answer
CHANGED
@@ -27,9 +27,9 @@
|
|
27
27
|
|
28
28
|
```sql
|
29
29
|
-- Oracle のミリ秒ってどういう扱いでしたっけ… こんなだっけ
|
30
|
-
where targetdate between
|
30
|
+
where targetdate between date(start_date || ' 00:00:00.000') and date(end_date || ' 23:59:59.999')
|
31
31
|
|
32
|
-
-- それだったらこっちですかね…?
|
32
|
+
-- それだったらこっちですかね…? 日付の加算は分からないので仮
|
33
|
-
where targetdate >=
|
33
|
+
where targetdate >= date(start_date || ' 00:00:00')
|
34
|
-
and targetdate <
|
34
|
+
and targetdate < (date(end_date || ' 00:00:00') + 1日)
|
35
35
|
```
|
1
追記:検索条件には日付型を指定したいのか
answer
CHANGED
@@ -7,6 +7,14 @@
|
|
7
7
|
yyyy-MM-dd で持つなら date型にしなくても良いような…
|
8
8
|
(yyyy-M-d とかなら話は別ですが)
|
9
9
|
|
10
|
+
【追記】
|
11
|
+
すみません、見落としてました。
|
12
|
+
|
13
|
+
> 日付 between 開始列 and 終了列
|
14
|
+
|
15
|
+
検索条件には日付型を指定したいということなんですかね。
|
16
|
+
であればこれより上 ↑ は無視してください。
|
17
|
+
|
10
18
|
----
|
11
19
|
|
12
20
|
ちなみに、もし文字列ではなく日付型で持つ場合は、
|