回答編集履歴

3

追記

2020/10/07 13:57

投稿

sazi
sazi

スコア25206

test CHANGED
@@ -21,3 +21,21 @@
21
21
  )
22
22
 
23
23
  ```
24
+
25
+ _TABLE_A と_TABLE_B の関係が1:nで、_TABLE_A のIDのリストまでは不要で単なる真偽だけでいいのなら、以下の方がコストは掛からないと思います。
26
+
27
+ ```SQL
28
+
29
+ select exists(
30
+
31
+ select 1 from _TABLE_B
32
+
33
+ where id = '1'
34
+
35
+ and '2020/10/07' <= update_date
36
+
37
+ and '2020/10/08' >= update_date
38
+
39
+ )
40
+
41
+ ```

2

訂正

2020/10/07 13:57

投稿

sazi
sazi

スコア25206

test CHANGED
@@ -21,21 +21,3 @@
21
21
  )
22
22
 
23
23
  ```
24
-
25
- 真偽しか求めていないなら単純に以下でも良いと思いますが。
26
-
27
- ```SQL
28
-
29
- select exists(
30
-
31
- select 1 from _TABLE_B
32
-
33
- where id = '1'
34
-
35
- and '2020/10/07' <= update_date
36
-
37
- and '2020/10/08' >= update_date
38
-
39
- )
40
-
41
- ```

1

追記

2020/10/07 13:46

投稿

sazi
sazi

スコア25206

test CHANGED
@@ -21,3 +21,21 @@
21
21
  )
22
22
 
23
23
  ```
24
+
25
+ 真偽しか求めていないなら単純に以下でも良いと思いますが。
26
+
27
+ ```SQL
28
+
29
+ select exists(
30
+
31
+ select 1 from _TABLE_B
32
+
33
+ where id = '1'
34
+
35
+ and '2020/10/07' <= update_date
36
+
37
+ and '2020/10/08' >= update_date
38
+
39
+ )
40
+
41
+ ```