GROUP_CONCAT with different SEPARATOR in laravel ExampleBy Hardik Savani | January 20, 2016 | | 9019 Viewer | Category : Laravel MySql
Whenever, you need to use GROUP_CONCAT with differente separator(I mean default separator is ',', But you want to change '@','#','&' etc as you want). then you have to use use SEPARATOR keyword in GROUP_CONCAT(). If you are working on laravel then you have to also use DB::raw() for write GROUP_CONCAT() inside the this function.
So, Basically how to change seprator in group_concat(), In following example i change ',' separator into '@'.you can use the following example how to use in laravel 4 and 5.
$items = DB::table('items')
,DB::raw("(GROUP_CONCAT(items_city.name SEPARATOR '@')) as `cities`"))
- Simple Highcharts Chart Example using PHP MySQL Database
- laravel 5 change date format using carbon example
- Laravel 5 dynamic autocomplete search using select2 JS Ajax - Part 1
- Bootstrap SweetAlert - Confirm dialog box model with yes and no option example
- Codeigniter Angularjs http post not working
- How to get Lat and Lon from google map API in Jquery PHP?
- How to get file size in php ?
- How to use soft delete in Laravel 5?