Tags
MySQL
Asked 7 years ago
23 Sep 2016
Views 911
sarah

sarah posted

how to concat two field in Mysql


SELECT customers_firstname+' '+customers_lastname FROM `customers`  


result:

customers_firstname+' '+customers_lastname
0
0
0

so i thought here '+' means plus not join two field

so i use


SELECT customers_firstname. ' '.customers_lastname FROM `customers`


result:
got Error

so how to concat two field in mysql ?
Mahesh Radadiya

Mahesh Radadiya
answered Nov 30 '-1 00:00

you can use CONCAT

select CONCAT(customers_firstname,'  ',customers_lastname) from `customers`


or concat with separator :CONCAT_WS

select CONCAT_WS('  ',,customers_firstname,customers_lastname) from `customers`



both give same output
Mitul Dabhi

Mitul Dabhi
answered Nov 30 '-1 00:00

simply use concat function of Mysql


select concat(customers_firstname,' ',customers_lastname) from `customers`
Post Answer