Php 获取联接中两个表的相同字段名值
我有两张表,分别是发货地址和账单地址。我对这些表使用join。但不幸的是,两个表的字段名是相同的。我想回显这两个数据Php 获取联接中两个表的相同字段名值,php,mysql,codeigniter,Php,Mysql,Codeigniter,我有两张表,分别是发货地址和账单地址。我对这些表使用join。但不幸的是,两个表的字段名是相同的。我想回显这两个数据 $this->db->select('a.*,b.*,c.*'); $this->db->from('pr_order_products as a'); $this->db->join('cust_bill_address as b','a.user_id = b.cust_id','inner');
$this->db->select('a.*,b.*,c.*');
$this->db->from('pr_order_products as a');
$this->db->join('cust_bill_address as b','a.user_id = b.cust_id','inner');
$this->db->join('cust_ship_address as c','a.user_id = c.cust_id','inner');
$this->db->where($cond);
$query = $this->db->get();
echo $this->db->last_query(); exit;
return $query;
如果我获取结果并
echo$order->cust\u id代码>表示它只从账单地址表中获取。有什么办法吗?在select语句中明确设置数据字段:
$this->db->select('
a.cust_id as a_cust_id,
b.cust_id as b_cust_id,
c.cust_id as c_cust_id,
etc...');
你可以用别名。是的…我不这么认为。。。