求教thinkphp如何定义查询条件包含多个复合查询
thinkphp吧
全部回复
仅看楼主
level 1
xqiaqiax 楼主
据用户手册所知thinkphp里同一级['_complex']只能定义一次,那如何用定义同一级两个并存的复合查询,例如下面的查询条件用thinkphp如何定义呢?
where (((id = 1 or id = 2 or id = 3) and type = 1) or ((id = 4 or id = 5 or id = 6) and (type = 2 or type = 3 or type = 4))) and status = 1
最终我想得到 where($condition), $condition该如何定义?
2012年09月24日 08点09分 1
level 1
xqiaqiax 楼主
1
2012年10月23日 14点10分 2
level 3
你直接把那个SQL语句的条件定义给
$condition就好了,还有了,你那个SQL语句没问题吧id=1这样的最好写成id='1'加个英文版单引号了
2012年11月02日 08点11分 5
level 1
你就不会用in 么 or那么多干嘛
2018年05月21日 01点05分 6
1