MS SQL Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsDatabasesMS SQL Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
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 DevelopersDownload Now!
  #1  
Old February 17th, 2004, 09:19 PM
BratCat2 BratCat2 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2004
Posts: 20 BratCat2 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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.)


Reply With Quote
  #2  
Old February 17th, 2004, 09:24 PM
mpearce's Avatar
mpearce mpearce is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2004
Location: NewHampshire, USA
Posts: 416 mpearce User rank is Corporal (100 - 500 Reputation Level)mpearce User rank is Corporal (100 - 500 Reputation Level)mpearce User rank is Corporal (100 - 500 Reputation Level)mpearce User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 4 Days 19 h 30 m 44 sec
Reputation Power: 9
Send a message via AIM to mpearce
You should just be able to put

First_name + ' ' + Last_Name AS Full_Name

in the query string.
__________________
Mark Pearce

Reply With Quote
  #3  
Old February 17th, 2004, 09:27 PM
BratCat2 BratCat2 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2004
Posts: 20 BratCat2 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
That was Fast

Quote:
Originally Posted by mpearce
You should just be able to put

First_name + ' ' + Last_Name AS Full_Name

in the query string.



Thanks !
Like this?
SELECT FROM Particpants.First_name + ' ' + Particpants.Last_Name AS Full_Name

Reply With Quote
  #4  
Old February 17th, 2004, 09:35 PM
mpearce's Avatar
mpearce mpearce is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2004
Location: NewHampshire, USA
Posts: 416 mpearce User rank is Corporal (100 - 500 Reputation Level)mpearce User rank is Corporal (100 - 500 Reputation Level)mpearce User rank is Corporal (100 - 500 Reputation Level)mpearce User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 4 Days 19 h 30 m 44 sec
Reputation Power: 9
Send a message via AIM to mpearce
Yep, that should do it..

Reply With Quote
  #5  
Old February 17th, 2004, 10:03 PM
BratCat2 BratCat2 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2004
Posts: 20 BratCat2 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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

Reply With Quote
  #6  
Old February 17th, 2004, 10:25 PM
mpearce's Avatar
mpearce mpearce is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2004
Location: NewHampshire, USA
Posts: 416 mpearce User rank is Corporal (100 - 500 Reputation Level)mpearce User rank is Corporal (100 - 500 Reputation Level)mpearce User rank is Corporal (100 - 500 Reputation Level)mpearce User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 4 Days 19 h 30 m 44 sec
Reputation Power: 9
Send a message via AIM to mpearce
Quote:
Originally Posted by BratCat2
Field: Full_Name
Table: Participants
Show is checked
Criteria: SELECT FROM Participants.First_name + ' ' + Participants.Last_Name AS Full_Name"

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..

Reply With Quote
  #7  
Old February 17th, 2004, 10:57 PM
BratCat2 BratCat2 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2004
Posts: 20 BratCat2 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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.

Reply With Quote
  #8  
Old February 17th, 2004, 11:01 PM
BratCat2 BratCat2 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2004
Posts: 20 BratCat2 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Worked in the VB Query Builder

Thank you !!!
It worked.

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesMS SQL Development > Joining two fields into one


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

 Free IT White Papers!
 
Accelerating Trading Partner Performance
One in five. That's how many partner transactions have at least one error. That is an amazing statistic, particularly given the extraordinary leaps in innovation across the global supply chain during the past two decades. Download this white paper to learn more.

 
Competing on Analytics
This Tech Analysis is designed to help identify characteristics shared by analytics competitors, and includes information about 32 organizations that have made a commitment to quantitative, fact-based analysis.

 
Cost Effective Scaling with Virtualization and Coyote Point Systems
An overview of the industry trend toward virtualization, how server consolidation has increased the importance of application uptime and the steps being taken to integrate load balancing technology with virtualized servers.

 
Five Checkpoints to Implementing IP Telephony
Implementation planning for IP PBX software and IP telephony has become vital as businesses replace discontinued legacy PBX phone systems. This informative whitepaper outlines five "checkpoints" for any implementation plan that will help make IP communications a successful proposition.

 
Hosted Email Security: Staying Ahead of New Threats
In the last two years, email has become a fierce battleground between the nefarious forces of spam and malware, and the heroes of messaging protection. The spam volumes increased alarmingly every month, bringing clever new forms of phishing and virus propagation attacks.

 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway