CodeIgniter Forums
Join two different databases - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Join two different databases (/showthread.php?tid=28345)



Join two different databases - El Forum - 03-08-2010

[eluser]sheldonnbbaker[/eluser]
Is there any way to do a join from a table in one database to a table in another database with active record?

I know it's possible with plain MySQL, but haven't found a way with AR in CI.

Thanks


Join two different databases - El Forum - 03-08-2010

[eluser]mah0001[/eluser]
try using the database name in the join:

Code:
$this->db->join('database2.table-to-join', 'database1.table.id= database1.table.id','inner');