我想从不同的表中选择两列:dbusers.students.ID
和dbusers.parents.ID
进入另一个数据库的另一个表:dbrecords.consultations.SENDER
将CodeIgniter代码转换为:
$this->dbrecords->select('consultations.*, dbusers.parents.*, dbusers.students.*');
$this->dbrecords->from('consultations');
$this->dbrecords->where('receiver', $id);
$this->dbrecords->order_by('DATE_SENT', 'DESC');
$this->dbrecords->order_by('TIME_SENT', 'DESC');
$this->dbrecords->join('sctporta_dbusers.parents', 'sctporta_dbusers.parents.ID = consultations.SENDER');
$this->dbrecords->join('sctporta_dbusers.students', 'sctporta_dbusers.students.ID = consultations.SENDER');
$query = $this->dbrecords->get();
return $query->result_array();
我的结果空洞了。如果我尝试只使用两个表,它可以工作。但我想将这两个表加入另一个表中。