Welcome Guest, Not a member yet? Register   Sign In
mySQL into Active Record
#1

[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('*');
$this->db->from('diary');
$this->db->join('jobs', 'jobs.id = diary.jobID');
$this->db->join('users', 'users.id = diary.userID');
$this->db->join('clients', 'clients.id = jobs.clientID');
$this->db->where('jobs.id', $this->id);

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


Messages In This Thread
mySQL into Active Record - by El Forum - 07-10-2007, 06:29 AM
mySQL into Active Record - by El Forum - 07-10-2007, 07:06 AM
mySQL into Active Record - by El Forum - 07-10-2007, 07:07 AM
mySQL into Active Record - by El Forum - 07-10-2007, 07:32 AM



Theme © iAndrew 2016 - Forum software by © MyBB