テーブルチケット(ユーザー名、投稿、スキーム)ユーザーが投稿する可能性があります。たとえば、
____________________________________
username | posts | scheme |
__________|____________|___________|
A | post1 | 10 |
__________|____________|___________|
B | post2 | 2 |
__________|____________|___________|
B | post 3 | 13 |
__________|____________|___________|
A | post 4 | 21 |
__________|____________|___________|
A | post 5 | -1 |
__________|____________|___________|
私のクエリは、タイトルの総数と評判の合計を含む個別のユーザー名を出力する必要があります。つまり、
_______________________
|A | 3 | 30 |
|____|_______|_________|
|B | 2 | 15 |
|____|_______|_________|
私のモデル機能:-
function getAllUsers(){
$this->db->distinct();
$this->db->select('username,COUNT(title) AS numtitle');
$this->db->where('site_referers_id',1);
return $this->db->get('tbl_tickets');
}
しかし、それはうまくいかないようです:(