unemployment Posted January 26, 2011 Share Posted January 26, 2011 how do I concat this field name while leaving a space? CONCAT(`users`.`firstname`, `users`.`lastname`) Quote Link to comment Share on other sites More sharing options...
Pikachu2000 Posted January 26, 2011 Share Posted January 26, 2011 CONCAT_WS() is what you'll need. Quote Link to comment Share on other sites More sharing options...
unemployment Posted January 26, 2011 Author Share Posted January 26, 2011 CONCAT_WS() is what you'll need. CONCAT_WS(`users`.`firstname`, `users`.`lastname`) I must be misunderstanding this. With the code above, it deletes my firstname from being displayed. Quote Link to comment Share on other sites More sharing options...
Pikachu2000 Posted January 26, 2011 Share Posted January 26, 2011 Actually, I just noticed that there are only two values in there. You can still use CONCAT_WS(), or you can just throw a space between the two values in CONCAT(). I tend to prefer the _WS version for retrieving more than 2 values unless the separator will be changing. CONCAT(`users`.`firstname`, ' ', `users`.`lastname`) Quote Link to comment Share on other sites More sharing options...
unemployment Posted January 26, 2011 Author Share Posted January 26, 2011 Actually, I just noticed that there are only two values in there. You can still use CONCAT_WS(), or you can just throw a space between the two values in CONCAT(). I tend to prefer the _WS version for retrieving more than 2 values unless the separator will be changing. CONCAT(`users`.`firstname`, ' ', `users`.`lastname`) Thanks, that worked. Did you get my PMs today? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.