Question:
How do I merge two values from separate fields using SQL?
An example would be taking the LastName field and placing it before the FirstName field like this: “LastName, FirstName”.
I would then like to generate a whole new field based on this result.
Answer:
You can accomplish your task simply by ordering the fields in the select list so that last name comes in the select list first.
If you actually want to combine Last Name and First Name so that they look like they came from one entry in one field, then you can issue this instead:
SELECT RTRIM(lastname)+' '+RTRIM(firstname)
Don’t forget the quotes and the embedded space, otherwise everything will run together most unattractively. I think this solution will get you home.
Charlie has over a decade of experience in website administration and technology management. As the site admin, he oversees all technical aspects of running a high-traffic online platform, ensuring optimal performance, security, and user experience.
Related Posts
- Report: Disney, Other Firms Replacing Developers with H-1B Visa Holders
- Microsoft Schedules Visual Studio 2015 Release for July 20
- Google Plans to Open 12 New Cloud Computing Data Centers
- Developer Edition HoloLens Will Sell for $3,000, Available in Q1 2016
- Bluemix Gets New Analytics, Data Warehousing Capabilities























