Saturday, February 11, 2017

Laravel group concat operation

It is important to get some concat value. You can use GROUP_CONCAT in Laravel easily. Below is a code snippet to do the trick:


$result = DB::table('table_name')
       ->select(DB::raw('group_concat(field_name) as field_name_alias'))
       ->where('condition_field', '=', $condition_value )
       ->first();

No comments:

Post a Comment