回答編集履歴
2
chousei
test
CHANGED
@@ -23,3 +23,27 @@
|
|
23
23
|
(meta_key=b and meta_value=あ and meta_value=え) →1or2
|
24
24
|
|
25
25
|
そのandをとると1のハズですが、命題では「1」及び「2」を得たいとのこと
|
26
|
+
|
27
|
+
|
28
|
+
|
29
|
+
# あらためて
|
30
|
+
|
31
|
+
|
32
|
+
|
33
|
+
```SQL
|
34
|
+
|
35
|
+
select post_id from(
|
36
|
+
|
37
|
+
select post_id from wp_postmeta where meta_key='a' and meta_value in('あ','い')
|
38
|
+
|
39
|
+
group by post_id having count(distinct meta_value)=2
|
40
|
+
|
41
|
+
union all select post_id from wp_postmeta where meta_key='b' and meta_value in('あ','え')
|
42
|
+
|
43
|
+
group by post_id having count(distinct meta_value)=2
|
44
|
+
|
45
|
+
) as sub group by post_id having count(*)=2
|
46
|
+
|
47
|
+
|
48
|
+
|
49
|
+
```
|
1
調整
test
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
>
|
1
|
+
> 1
|
2
2
|
|
3
3
|
|
4
4
|
|
@@ -12,7 +12,7 @@
|
|
12
12
|
|
13
13
|
|
14
14
|
|
15
|
-
> 2
|
15
|
+
> 2
|
16
16
|
|
17
17
|
|
18
18
|
|