开发者

MYSQL merge columns

开发者 https://www.devze.com 2022-12-20 12:06 出处:网络
I\'m using MySQL and do a select: SELECT LTRIM(Firstname + \' \' Lastname) AS Fullname FROM Persons My result is 0 for every result.

I'm using MySQL and do a select:

SELECT LTRIM(Firstname + ' ' Lastname) AS Fullname FROM Persons

My result is 0 for every result.

Even if i remove the LTRIM, Using C开发者_运维技巧ONCAT is giving the same problem.


You are arithmetically adding the string values together; unless you have "1ohn 5mith" in the db, this will always be 0.

Does SELECT LTRIM(CONCAT(Firstname,' ',Lastname)) AS Fullname FROM Persons give you the same problem? (note that there are 3 parameters to CONCAT() here: Firstname, a one-character string containing a space, and Lastname; this function takes as many arguments as you throw at it and outputs them as a string)

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号