此问题在此处已有答案:
Using column alias in WHERE clause of MySQL query produces an error(7个答案)
Concat in Codeigniter Active Record(5个答案)
8个月前关闭。
这是我的疑问
$this->db->select('
CONCAT(customers.first_name, " ", customers.last_name) AS full_name
');
$this->db->where('full_name', $customerSearch);
$run_q = $this->db->get('customers');
但我收到错误。
Unknown column 'full_name' in 'where clause'
我怎么了?
1条答案
按热度按时间uxhixvfz1#
请尝试以下操作:
出现错误,因为不能在“where”子句中使用“derived column”的别名(即full_name)。