GROUP_CONCAT with different SEPARATOR in laravel ExampleBy Hardik Savani | January 20, 2016 | | 10563 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`"))
- Select box with search option example in Jquery using Chosen Plugin
- Response download with file in Laravel 5.3 example
- Laravel 5.3 - image dimension validation rules example
- AngularJS - update bind ng-model input value from Jquery Code
- How to scrolling table with fixed header in HTML?
- Laravel 5 - Paypal Payment Integration example using netshell/paypal package from scratch
- Laravel - How to search with comma separated values using Query Builder ?
- How to upload image with validation in PHP Codeigniter?