【发布时间】:2016-08-10 17:18:56
【问题描述】:
我有以下表格:
表用户
| id | profile_img |
--------------------
| 21| name.img|
| 22| name.img|
| 33| name.img|
表 user_translations
|id | user_id |first_name |
--------------------------
| 1| 21 | panais |
| 2| 22 | andreas|
| 3| 33 | minas |
关于表
| id | user_id |
----------------
| 1| 33 |
| 2| 22 |
| 3| 21 |
餐桌用品
| id | user_id |
----------------
| 1| 33 |
| 2| 22 |
| 3| 21 |
| 4| 21 |
| 5| 33 |
每个用户都可以写
关于
about table的文章和things table的文章
我想获得所有用户的文章总数。换句话说,我想从user_translations 表中获取 minas 总共写了 3 篇文章。
感谢任何帮助。
更新
我已经发布了答案
【问题讨论】:
-
尝试使用
count(DISTINCT (things.id))和count(DISTINCT(about.id))...在下面查看我的答案
标签: mysql sql laravel laravel-5