GROUP_CONCAT with different SEPARATOR in laravel ExampleBy Hardik Savani | January 20, 2016 | | 3925 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`"))
- Jquery - Show hide password in Password textbox using checkbox.
- How to add LIKE query in Elasticsearch?
- Twitter Bootstrap - Digital Clock picker with AM PM example using clockface plugin
- Laravel 5 - Authenticate user in NodeJS with socket io using JWT.
- How to uninstall cordova and ionic in ubuntu
- Laravel 5 - Multiple Images Uploading using dropzone.js example with demo
- How to retrieve number of twitter followers count without authentication or api ?
- How to redirect to external link with laravel 5?