tp3.2 and or的复合查询


$where['user_id']  = $user_id;
$where['buy_id'] = $user_id;
$where['_logic'] = 'or';
$map['_complex'] = $where;
$map['trade_type'] ='1';
$map['status'] = array('gt',0);
$marketdata = M('Market')->where($map)->select();
echo M()->_sql();
原生语句就是 
SELECT * FROM `erj_market` WHERE ( `user_id` = '13' OR `buy_id` = '13' ) AND `trade_type` = 1 AND `status` > 0

 

posted @ 2020-12-31 09:31  大熊童鞋  阅读(355)  评论(0编辑  收藏  举报