Illegal mix of collations for operation '='

坚强是说给别人听的谎言 提交于 2020-01-05 04:16:14

问题


I want to select data from table 'invoice_data' where the value of company name will be choosen from the table 'crm_accounts' by value of email. I am getting error like

Illegal mix of collations (utf8_unicode_ci,IMPLICIT) and (utf8_general_ci,IMPLICIT) for operation '='

This is my model code:

public function view_invoice($email)
    {
        $this->db->select('invoice_data.*, crm_accounts.company');
        $this->db->from('invoice_data');
        $this->db->join('crm_accounts', 'invoice_data.cname = crm_accounts.company', 'inner');
        $this->db->where('crm_accounts.email', $email);
        $query = $this->db->get();
        return $query->result_array();
    }

回答1:


try this;

public function view_invoice($email)
{
    $this->db->select('invoice_data.*, crm_accounts.company');
    $this->db->from('invoice_data');
    $this->db->join('crm_accounts', 'invoice_data.cname = crm_accounts.company COLLATE utf8_unicode_ci', 'inner');
    $this->db->where('crm_accounts.email', $email);
    $query = $this->db->get();
    return $query->result_array();
}


来源:https://stackoverflow.com/questions/38738042/illegal-mix-of-collations-for-operation

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!