MYSQL merge columns
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)
精彩评论