mysql查询中的技巧
第一种: $res =Db::name('channel')->where('(fenlei=15 AND add_time > '.strtotime("-5 min").')')->fetchSql()->select(); 第二种: $where = [ [ ['status','=',2], ['fenlei','=',15], ['account','=',$results[$k]['account']], ], [ ['status','=',3], ['fenlei','=',15], ['account','=',$results[$k]['account']], ], ]; $m = Db::name('channel')->fieldRaw('SUM(money)')->whereOr($where)->find();