In Codeigniter, how we handle many to many relationship between table....how we handle the pivot table?

Codeigniter has join functions with active records enabled. Like: $this->db->join(table, matching id, type);, but with complex tables I write my queries out. Like:

$sql = "SELECT item_id, 
        MAX(IF(prop = 'color', value, NULL)) AS color, 
        MAX(IF(prop = 'size', value, NULL)) AS size 
        FROM properties GROUP BY item_id;";

$q = $this->db->query( $sql );
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.