[eluser]winter[/eluser]
Maybe I'm doing something wrong. However, I've been able to run these kind of queries before(non-CI AR)
Doing this:
Code:
$this->db->select('resreq.*, resreq.id AS resreq_id, area.id AS area_id, area.name AS area_name');
$this->db->from('resreq');
$this->db->join('areas', 'areas.id = resreq.unit');
$data['query'] = $this->db->get('resreq');
Results in this:
Code:
An Error Was Encountered
Error Number: 1054
Unknown column 'area.id' in 'field list'
SELECT resreq.*, resreq.id AS resreq_id, area.id AS area_id, area.name AS area_name FROM (`resreq`) JOIN `areas` ON areas.id = resreq.unit
This does work:
Code:
$this->db->select('resreq.*, resreq.id AS resreq_id');
$this->db->from('resreq');
$this->db->join('areas', 'areas.id = resreq.unit');
$data['query'] = $this->db->get('resreq');
However, I have no way of referencing the area.name field in my view:
Code:
<td><?=$row->area_name?></td>
Is there a work around for this? Or is this a bug? It seems like a pretty common thing to want to do.
Thanks...