为了账号安全,请及时绑定邮箱和手机立即绑定

thinkphp一条WHERE查询的写法

thinkphp一条WHERE查询的写法

蝴蝶不菲 2019-02-17 16:29:48
where [id] = array(*neq*,5); where[*age*] = array(*egt*, 20);这个变成SQL就是 where id != 5 and age >= 20;但我现在要更复杂的SQL语句: where (id != 5 and age > 20 ) or (id > 15 and age < 18 ) ;THINKPHP 应该怎写?
查看完整描述

1 回答

?
www说

TA贡献1775条经验 获得超8个赞

1

2

3

4

5

6

$where['id'] = array('neq','5');

$where['age'] = array('egt','20');

$map['id'] = array('gt','15');

$map['age'] = array('lt','18');

$where['_logic'] = 'OR';

$map['_complex'] = $where;


查看完整回答
反对 回复 2019-02-18
  • 1 回答
  • 0 关注
  • 586 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信