Search
 
SCRIPT & CODE EXAMPLE
 

SQL

concat column data in sql laravel

//must have
use IlluminateSupportFacadesDB;

Model::select(DB::Raw("CONCAT(profiles.first_name, ' ', profiles.last_name) AS name"))->get();

//concat other table data and display as one line with ',' as a delimiter
//DB::Raw("(SELECT GROUP_CONCAT(a.contact_number) FROM contacts as a JOIN users as b ON a.user_id = b.user_id WHERE a.user_id = users.user_id) AS contact")
//expected output would be 09123456789,09876543210,09000000000
Comment

PREVIOUS NEXT
Code Example
Sql :: how to use rank function in sql 
Sql :: postgres create extension if not exists 
Sql :: order by desc postgres 
Sql :: How do I modify a MySQL column to allow NULL? 
Sql :: mysql delete all except 
Sql :: mysql on duplicate key update 
Sql :: mysql change password 
Sql :: run sql file in terminal 
Sql :: describe table postgres 
Sql :: run postgres docker 
Sql :: restart sql server command line linux 
Sql :: select last row in sql 
Sql :: sql select into statement 
Sql :: oracle list datafiles 
Sql :: postgres list databases 
Sql :: mysql query dates between two dates 
Sql :: default constraint in ms sql 
Sql :: t-sql drop function if exists 
Sql :: update table from another table 
Sql :: add column postgres with default value 
Sql :: sql #region 
Sql :: postgres list users 
Sql :: drop all tables in azure sql database 
Sql :: mysql trim spaces 
Sql :: return result of function in postgresql 
Sql :: sql count unique values in one column 
Sql :: postgre alter table foreign key 
Sql :: truncate all tables 
Sql :: database timezone 
Sql :: oracle index size 
ADD CONTENT
Topic
Content
Source link
Name
7+6 =