Laravel 5 Inner Join And Group By Query Syntax Error
please help me with my format query in laravel 5. I am a beginner in using laravel 5, and i just search to came up with this query, but now i am getting error i dont know where and
Solution 1:
You have extra starting [
in this line:-
->where([['DATE(shipping_table.sold_date)', '=',$date, ['shipping_table.shipping_status', '=' ,1]])
It need to be (use DB::raw()
to use mysql functions
):-
$date = date("Y-m-d", strtotime($request->datepicker2));
$products = DB::table('shipping_table')->select('products.product_name', 'products.price', DB::raw("Sum(shipping_products.quantity) as qtysold"), 'shipping_table.sold_date')->join('shipping_products','shipping_table.shipping_id', '=', 'shipping_products.shipping_id')->join('products','products.product_id', '=', 'shipping_products.product_id')->where([[DB::raw("date(shipping_table.sold_date)"),$date], ['shipping_table.shipping_status', '=' ,1]])->groupBy('products.product_name')->paginate(8);
Note:-
Regarding the error you get (Syntax error or access violation: 1055
) check this answer and do accordingly:-
Post a Comment for "Laravel 5 Inner Join And Group By Query Syntax Error"