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`) Link to comment https://forums.phpfreaks.com/topic/225699-concat/ Share on other sites More sharing options...
Pikachu2000 Posted January 26, 2011 Share Posted January 26, 2011 CONCAT_WS() is what you'll need. Link to comment https://forums.phpfreaks.com/topic/225699-concat/#findComment-1165339 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. Link to comment https://forums.phpfreaks.com/topic/225699-concat/#findComment-1165343 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`) Link to comment https://forums.phpfreaks.com/topic/225699-concat/#findComment-1165344 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? Link to comment https://forums.phpfreaks.com/topic/225699-concat/#findComment-1165348 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.