Reputation: 177
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 CONCAT is giving the same problem.
Upvotes: 1
Views: 675
Reputation: 92762
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)
Upvotes: 4