on-internet
← Community

COUNT the related rows from a JOINed table in CodeIgniter [duplicate]

Stack Overflow ·

I have a query which grabs all users from the wait table based on $oneid. This works just fine but I would like to count how many messages a user leaves. These are in another table one_msg. function waiting_users($oneid) { $query_str = "SELECT a.user_id, b.email, b.username, b.fbook, c.user_id as saved_user, d.type as user_type, FROM wait a LEFT JOIN users b ON a.user_id=b.id JOIN user_profiles d ON a.user_id=d.user_id LEFT JOIN save_one c ON a.user_id=c.user_id AND c.one_id=? WHERE a.post_id = ? ORDER BY a.date ASC"; } $query = $this->db->query($query_str, array($oneid, $oneid)); one_msg tabl

Comments

Sign in or sign up to comment and upvote.

No comments yet.