CI的Active Record 类如何处理where语句的问题
本帖最后由 yuzhigang5460 于 2011-5-19 17:00 编辑where ( c.Name = 'Jack' AND c.Sex='Male' ) OR(m.Tel = '12353' AND m.Mail='mail')
这样的逻辑如何使用CI的where和or_where实现呢?
难道CI做不到? 回复 yuzhigang5460 的帖子
做不到就别纠结了,直接写sql吧 yuzhigang5460 发表于 2011-5-19 16:58 static/image/common/back.gif
这样的逻辑如何使用CI的where和or_where实现呢?
难道CI做不到?
$where = '你想要的SQL条件语句';
$this->db->where($where);
就这么简单。其实你的那个where完全可以由CI实现。 前面的是m和c是表名吗? $this->db->where("( c.Name = 'Jack' AND c.Sex='Male' )","",false)
$this->db->or_where("(m.Tel = '12353' AND m.Mail='mail')","",false) visvoy 发表于 2011-5-20 19:30 static/image/common/back.gif
$this->db->where("( c.Name = 'Jack' AND c.Sex='Male' )","",false)
$this->db->or_where("(m.Tel = '123 ...
竟然居然果然能这么写,谢谢啊。:D
页:
[1]