【发布时间】:2023-03-24 20:54:01
【问题描述】:
> *1.我需要在活动记录中写这个 *
我需要加入这3张表,但是加入的条件非常有选择性
$this->db->select(name);
$this->db->from('table0');
$this->db->join('table1','(table1.id=0 AND table0.feild1 = table1.feild1) OR (table1.id=1 AND table0.feild2 = table1.feild2)') // <--- how to write this is my question
我可以做一个简单的连接,但主要问题是实现我上面提到的连接条件。这也是非常非常的一小部分!大查询,所以我真的无法将其更改回本机 sql 查询,例如:
$this->db->query('//entire sql query'); //cant do this, need to write ACTIVE RECORDS
当我写活动记录时,萤火虫给我一个错误说:
您的 SQL 语法有错误;检查手册 对应于您的 MySQL 服务器版本,以便使用正确的语法 ') 或
有什么建议吗?
【问题讨论】:
标签: mysql codeigniter activerecord