当我尝试这段代码时:
$this->db->select('customers.customerid, customers.firstname');
$this->db->from('customers');
$this->db->join('orders', 'orders.customerid = customers.customerid');
$this->db->join('order_domains', 'order_domains.orderid = orders.orderid');
$this->db->join('order_hostings', 'order_hostings.orderid = orders.orderid');
$this->db->join('order_servers', 'order_servers.orderid = orders.orderid');
$this->db->group_by('orders.customerid');
$query = $this->db->get();
$domainusers = $query->result();
var_dump($domainusers);
我尝试过使用内部连接,但我尝试的一切仍然会返回一个空结果:
var_dump(); ---> array(0) { }
当我注释掉最后 3 个联接中的两个时:
//$this->db->join('order_hostings', 'order_hostings.orderid = orders.orderid');
//$this->db->join('order_servers', 'order_servers.orderid = orders.orderid');
它将返回结果:
var_dump(); ---> array(1) { [0]=> object(stdClass)#17 (1) { ["customerid"]=> string(1) "1" } }
我正在为这个项目使用codeigniter,有没有人知道为什么我使用多个连接后它会返回空结果?