“表1”如何联合所有笨
$this->db->select('referral1.*, client.*, employee.* ');
$this->db->from('client');
$this->db->join('referral1', 'client.referral_id = referral1.referral1_id', 'inner');
$this->db->join('assign_psychotherapist ', 'assign_psychotherapist.a_referral_id = client.referral_id', 'inner');
$this->db->join('employee ', 'assign_psychotherapist.a_psychotherapist_id = employee.empid', 'inner');
$this->db->where("referral_status ='Assigned' OR referral_status ='Accepted' ");
$this->db->order_by("referral_date", "desc");
“表2”
$this->db->select('referral1.*, client.*, volunteer.* ');
$this->db->from('client');
$this->db->join('referral1', 'client.referral_id = referral1.referral1_id', 'inner');
$this->db->join('assignvolunteer', 'assignvolunteer.Vreferralid = client.referral_id', 'inner');
$this->db->join('volunteer', 'assignvolunteer.Vvolunteerid = volunteer.volid', 'inner');
$this->db->where("referral_status ='Assigned' OR referral_status ='Accepted' ");
$this->db->order_by("referral_date", "desc");
我怎么能这两个查询一起加入这个查询代码?
有一个错误“UNION和秩序的不正确的使用情况” – Rjgapz 2015-04-01 15:42:51
为确定抱歉。请检查更新后的答案,我使用过*,因为我不确切知道您将使用哪些列。 – Arzgethalm 2015-04-01 15:46:06
谢谢你的帮助,但我仍然有一个错误“重复的列名” – Rjgapz 2015-04-01 16:41:19