CodeIgniter Forums
DB Active Record issue - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21)
+--- Thread: DB Active Record issue (/showthread.php?tid=13173)



DB Active Record issue - El Forum - 11-13-2008

[eluser]Eric Barnes[/eluser]
Hi everyone.

I am running CI 1.6.1 which I know is a little old now and I didn't want to upgrade if I didn't have to. Smile

My problem is I have this query:
Code:
$this->db->distinct();
        $this->db->select('a_id, a_uri, a_title, a_display, a_hits');
        $this->db->from("articles");
        $this->db->join('article2cat', 'articles.a_id = article2cat.article_id', 'left');
$query = $this->db->get();

Which outputs as:
SELECT DISTINCT a_id, a_uri, a_title, a_display, a_hits FROM (a_articles) LEFT JOIN a_article2cat ON a_articles.id = a_article2cat.article_id

Notice that the table names becomes a_article2cat and a_articles where it should be just article2cat and articles.

Does anyone have any idea on what would be causing that?