mySQL into Active Record - 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: mySQL into Active Record (/showthread.php?tid=1986) |
mySQL into Active Record - El Forum - 07-10-2007 [eluser]KJTED[/eluser] Hello everyone, I'm having a problem converting a traditional MySQL query into one that uses the Active Record class. The query I have is Code: $sql = 'SELECT * , diary . id as diaryID FROM `diary` JOIN jobs on jobs . id = diary . jobID JOIN users on users . id = diary . userID JOIN clients On clients . id = jobs . clientID LIMIT 0, 30 '; I've managed to get this so far Code: $this->db->select('*'); but I'm having problems with putting the following slice into my Active Record query Code: 'SELECT * , diary . id as diaryID Does anyone know how to do this? I've looked into the documentation but there doesn't seem to be anything on this. Thanks KJ mySQL into Active Record - El Forum - 07-10-2007 [eluser]champs[/eluser] If it's not taking to anything, it's the spaces. I've never used that style, but here's how I would write the same query: Code: <?php ... and don't let anyone tell you to just use straight queries/bindings :p mySQL into Active Record - El Forum - 07-10-2007 [eluser]KJTED[/eluser] Thanks man! I'll give that a shot and let you know how it goes mySQL into Active Record - El Forum - 07-10-2007 [eluser]KJTED[/eluser] That worked brilliantly. *manly hug* |