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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Joining 5 table fields into 1 field

Status
Not open for further replies.

ellford

Programmer
Joined
Nov 19, 2004
Messages
13
Location
US
Okay, I'm wracking my brain here and can't find the answer to this one...

I have a table (lets call it tbl_names) with 5 fields (for this lets just use 2 and call them FirstName and LastName) that I need to join together to make one field (lets call it Name).

Now I've created a query that goes as follows:

SELECT FirstName & LastName AS comprehensive FROM tbl_names

Unfortunately, it's not joining the fields together. Perhaps I need to use an AS statement or something?

Anyone have any ideas? H E L P . . .
 
Can you please post some input samples, what you really tried, what you obtained and expected result ?

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
That should be working just fine as a query (however, there's no space between the parts of the name, intentional?). Is it giving you an error or something?

Make sure you have the ending semicolon (;)

:-)
 
why not start a new query.
select the table you want
in a blank field entry type;
[field1]&[field2]&[field3]&[field4]&[field5]
open the query and see if it gives you the correct results. Then, if you like, check "view", "SQL" and see how it concancated them.
 
How are ya ellford . . . . .

[blue]The syntax you've posted is just fine[/blue]. Has to be something with what you substituted!

[blue]PHV[/blue] has already asked . . . . post an actual example . . . .

Calvin.gif
See Ya! . . . . . .
 
Hit submit too soon . . . . .

Check your [blue]spelling[/blue], and if any any field names have spaces, you have to [blue]enclose the field name in brackets.[/blue]

[purple][First Name][/purple]

Calvin.gif
See Ya! . . . . . .
 
[LastName]&", "&[FirstName]

It'll produce LastName, FirstName
 
Ahhh, okay it must have been due to it being a Friday, this works fine...

Crazy!
 
It worked correctly from the get go... For some reason it wasn't working on Friday, but it's working now...

I did have to change it ever so slightly to allow a space in between the first and last name:

SELECT FirstName & ' ' & LastName AS comprehensive FROM tbl_names
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top