|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Learn five alternative approaches for automating the delivery of Excel-based reports. Read all about it in the free whitepaper: “Automating Excel Reports: Five Approaches for Java Developers” Download Now!
|
|
#1
|
|||
|
|||
|
Joining two fields into one
I have two fields in one table called Particpants
First field is "Last_Name" Second is "First_name" How can I conbine both fields into one field so the first and last name are together ? Thank you. (Using Access 2000 and trying to write a SQL statement in VB6 for this.) ![]() |
|
#2
|
||||
|
||||
|
You should just be able to put
First_name + ' ' + Last_Name AS Full_Name in the query string.
__________________
Mark Pearce |
|
#3
|
|||
|
|||
|
That was Fast
Quote:
Thanks ! Like this? SELECT FROM Particpants.First_name + ' ' + Particpants.Last_Name AS Full_Name |
|
#4
|
||||
|
||||
|
Yep, that should do it..
|
|
#5
|
|||
|
|||
|
Didn't work
I tried the query in Access. I created the field "Full_Name in the table and In the Access query builder I have this:
Field: Full_Name Table: Participants Show is checked Criteria: SELECT FROM Participants.First_name + ' ' + Participants.Last_Name AS Full_Name" When I run it I see the Full_Name field but no data under it. The Last_Name and First_Name fields have data in the database. Syntax error ? Do I need to remove the ' ' marks from my query ? THX |
|
#6
|
||||
|
||||
|
Quote:
It seems to work in MS SQL , but the syntax may be a different for Access. I found this in the ASP Free forums: http://forums.aspfree.com/t20139/s.html It shows the syntax like this: SELECT [Table1]![LName] & ", " & [Table1]![FName] AS FullName FROM [Table1]; You might try using the & instead of the +.. Or, try using FROM Participants at on the end of the query string.. So, try.. ( this is how I tested it in MS SQL Query builder ) SELECT Participants.First_name + ' ' + Participants.Last_Name AS Full_Name FROM Participants Or SELECT Participants.First_name & ' ' & Participants.Last_Name AS Full_Name FROM Participants Hope this helps.. |
|
#7
|
|||
|
|||
|
field in builder
Did you have the Full_Name as the field in MS Query Builder ?
or do I need to remove the field in the table beforehand and let the query build the 'Full_name" field from the query ? I used the Full_Name as the field name in the builder. THX Ran it both ways and got Full_Name but no data again. |
|
#8
|
|||
|
|||
|
Worked in the VB Query Builder
Thank you !!!
It worked. |
![]() |
| Viewing: Dev Shed Forums > Databases > MS SQL Development > Joining two fields into one |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|