GROUP_CONCAT with different SEPARATOR in laravel ExampleBy Hardik Savani | January 20, 2016 | | 2444 Viewer | Category : Laravel MySql
Share this post:
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`"))
- How to check file size when select multiple file validation using Jquery?
- How to select concat columns with Laravel Query Builder?
- CRUD (Create Read Update Delete) Example in Laravel 5.2 from Scratch
- How to send mail using Sendgrid in laravel 5?
- How to add jquery modal popup in PHP?
- Laravel 5 - elasticsearch with pagination example
- Laravel 5 - create quick backend admin panel tutorial
- Jquery notification popup box example using toastr JS plugin with demo