加入3个数据库表,从表2中获取一个表和一个表

时间:2013-11-27 13:45:48

标签: php sql codeigniter

我需要customer_account的完整表格和公司佣金的一个专栏佣金 表ewallet_fund_transfer中的主键为id,即company_commission中的引用键。我希望在此参考ID前面进行佣金。

function account_summary($userId, $acId)
{
    $this->db->select('customer_account.*,company_commission.commission');
    $this->db->from('customer_account');
    $this->db->join('company_commission', 'customer_account.customerID=company_comession.customer_id','inner');
    $this->db-> where('customerID', $userId);
    $this->db-> where('curr_ac_id', $acId);
    $this->db-> where('ewallet_fund_transfer.id=company_comession.reference_id');

    $query = $this->db->get();
    return $query->result();
}

0 个答案:

没有答案
相关问题