I have a table Person
with fields LastName
, FirstName
and MiddleName
.
I would wanted to display in datatable as one column the LastName, FirstName MiddleName
Is it possible? How?
I believe you can do SELECT CONCAT(LastName, ", ", FirstName, " " , MiddleName ) as Name FROM Person
. This will concat all names in one column named Name. Second blank " " is to set a gap between First and Middle Name.
只需使用MySQL CONCAT函数即可实现
SELECT CONCAT(LastName,' ', FirstName,' ',MiddleName) AS PersonName From Person;
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.