CodeIgniter Forums
Active Record question - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Libraries & Helpers (https://forum.codeigniter.com/forumdisplay.php?fid=22)
+--- Thread: Active Record question (/showthread.php?tid=41027)



Active Record question - El Forum - 04-26-2011

[eluser]Unknown[/eluser]
Hi,

I have a SQL statement that works fine but I want to re-create it using Active Record so I make the SQL safer etc. Here is my current SQL is it possible to re-create this?

Code:
$query = $this->db->query("SELECT p.*, a.*, c.* from databaseTableOne p JOIN databaseTableTwo a ON a.UniqueID = p.UniqueID INNER JOIN databaseTableThree c ON p.UniqueID = c.UniqueID WHERE p.UniqueID = '".$var."' AND p.Deleted = '0' LIMIT 1");

Update*

Found this post that should solve the issue I was having

http://ellislab.com/forums/viewthread/109045/