回答編集履歴

1

追記

2020/10/04 08:25

投稿

kuma_kuma_
kuma_kuma_

スコア2506

test CHANGED
@@ -11,3 +11,37 @@
11
11
  ```
12
12
 
13
13
  でよいのでは?
14
+
15
+
16
+
17
+ 追記
18
+
19
+ [TableSelect::having](https://www.php.net/manual/ja/mysql-xdevapi-tableselect.having.php)
20
+
21
+ こちらでの書き方
22
+
23
+
24
+
25
+ ```PHP
26
+
27
+ $result = $table->select('count(*) as count', 'age')
28
+
29
+ ->groupBy('age')->orderBy('age asc')
30
+
31
+ ->having('count > 1')
32
+
33
+ ->execute();
34
+
35
+ ```
36
+
37
+
38
+
39
+ の様に一度'count('posts.id') as count'の様にカウントに項目名を付けて
40
+
41
+ ```PHP
42
+
43
+ ->having('count', '=', $tags_count);
44
+
45
+ ```
46
+
47
+ と書かれては?