Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Add data from two columns into one

Status
Not open for further replies.

29466999

Programmer
Nov 22, 2002
13
DK
Hello - I need some SQL help on this one:

I got a table with two columns:
FirstName LastName
---------------------
Peter Andersen
Michael Johnson
Rasmus McDonald

In a new table i need to merge the data of the two columns into one column, and add a '-' between. So it should look like this:

FullName
---------------------
Peter-Andersen
Michael-Johnson
Rasmus-McDonald

What SQL code should I write to make this work?

Best regards

M
 
I would use;

SELECT FirstName + '-' + LastName AS FullName FROM TABLE_NAME

Regards,
G
 
Hi!
I´ve run into the same problem and (MIS) solution did not work for me. When I run the sql statement the resutlt
i get is one row with "Fullname" but it only shows whats in FirstName and noting else.

Do you have any suggestion on what I´m doing wrong or how I can get pass this problem of mine?

Best Regards
/A

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top