【发布时间】:2017-11-26 15:10:11
【问题描述】:
我的以下查询在第二个 where (search_price
$query = Product::where('product_name', '!=', 'product_name');
$likes = DB::table('likes')->selectRaw('product_id, COUNT(*) as count')
->groupBy('product_id')
->orderBy('count', 'desc')
->get();
foreach($likes as $like){
if($like == $likes[0]){
$query->where('aw_product_id', $like->product_id');
}
else{
$query->orWhere('aw_product_id', $like->product_id');
}
}
$query->whereRaw('search_price != rrp_price');
$products = $query->get();
所以,如果我取出 'search_price
我的 where 语句有什么明显错误吗?
【问题讨论】:
-
search_price 在哪里
-
search_price
-
啊抱歉,应该是 != 我一直在玩 != 和
标签: php mysql laravel-5 eloquent where