1.查询之_string:
例子:
$m=M('indentlist');
$where['_string'] = "(indentstate = 'NeedPay') or (indentstate = 'Shipped')";
$where['state'] =0;
直接出来的语句:
SELECT * FROM `indentlist` WHERE ( (indentstate = 'NeedPay') or (indentstate = 'Shipped') ) AND ( `state` = 0 )
2.查询之_complex,_logic:
例子:
$m=M('indentlist');
$email = $_GET['email'];
$condition['state'] =array('GT',0);
$condition['Indentstate'] ='Finished';
$condition['_logic'] ='or';
$map['_complex'] = $condition;//条件查询,完成的订单,退货订单,异常订单
$map['email'] = $email;
$data=$m->where($map)->select();
直接出来的语句:
SELECT * FROM `indentlist` WHERE ( (indentstate = 'Finished') or (state >0) ) AND ( `email` = '782172838@qq.com' )