2016-12-18 14 views
0

私はlaravel 5.2フレームワークを使用していますが、このWhereBetweenは動作しません。私は価格が500から4000の形で始まる価格帯を使用しています。クエリを実行すると空のレコードが得られますが、WhereBetween()を削除するとすべてのレコードが取得されます。これを解決する方法を教えてください。Laravel 5.2 whereBetween not working

$query = Property::query(); 
     $query->select('properties.property_id', 'properties.property_title', 'properties.description', 'properties.latitude', 'properties.longitude', 'properties.city_name', 'properties.state_name'); 
     $query->leftjoin('properties_base_season_price_transactions', 'properties_base_season_price_transactions.parent_id', '=', 'properties.property_id'); 
     $query->leftjoin('properties_availability', 'properties_availability.property_id', '=', 'properties.property_id'); 
     $query->where('properties.property_category_id', $post_data['categoryid']); 
     $query->where('properties.property_sub_category_id', $post_data['subcategoryid']); 
     $query->where('properties.city_name', 'LIKE' , '%'.$post_data['city'].'%'); 
     $query->whereBetween('properties_base_season_price_transactions.price', [500, 4444]); 
     $query_output = $query->get()->toArray(); 
+0

データ型を試してみてください? – Abhishek

+0

@Abhishekデータ型はvarchar .. –

+1

データ型は 'integer'または' float'(または同様の数値データ型)でなければなりません。 –

答えて

0

whereBetweenに何か問題があるようですproperties_base_season_price_transactions.priceの

->whereRaw("properties_base_season_price_transactions.price BETWEEN 500 AND 4444");