Welcome Guest, Not a member yet? Register   Sign In
Sub Queries or better way to do this?

I need to take this query:

PHP Code:
    public function get_active_pools() {
        $query $this->db->get('pools');
        return $query->result();

and join it to a second table that is related by an id and then count how many times the id of the first table is listed in the second table. What is my best method of doing this with Query Builder?

(This post was last modified: 05-18-2016, 04:48 AM by fakhrawy.)

first you need to add join line to be like this
then return by count like this
return $query->num_rows();

Theme © iAndrew 2016 - Forum software by © MyBB