我为mysql尝试过的以下查询,它工作正常,但我需要以codeigniter活动记录类的形式进行查询。
SELECT name FROM tblmarkets_football WHERE name <> CONVERT(name USING ASCII);
我尝试了类似的方法,但是它不起作用,出现500错误....
$wherestr = 'tblmarkets_football.name <>'. CONVERT(tblmarkets_football.name. ' USING ASCII');
$this->db->select('*');
$this->db->from('tblmarkets_football');
$this->db->join('tblmarkets','tblmarkets.id = tblmarkets_football.market_id','left');
$this->db->where($wherestr);
答案 0 :(得分:0)
如果您在转义时在条件&WHERE
中传递了NULL
值,则Active Record允许在FALSE
中使用自定义字符串。
$wherestr =
'tblmarkets_football.name <> CONVERT(tblmarkets_football.name USING ASCII)' );
$this->db->where( $wherestr, NULL, FALSE );
请参阅有关->where()
方法的文档:
https://www.codeigniter.com/userguide3/database/query_builder.html#looking-for-specific-data