Microsoft Access Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsDatabasesMicrosoft Access Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
Stay one step ahead of the competition. Evaluate and give feedback on some of the hottest web development tools on the market today. Make your opinion heard! Click Here
  #1  
Old April 28th, 2008, 09:36 PM
deb40 deb40 is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2008
Posts: 2 deb40 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 20 m 47 sec
Reputation Power: 0
Combining multiple fields from one table

Hi,
I need to combine 10 fields into 2 fields. example:
Original table
Date#1 Trainer#1 Date#2 Trainer#2 Date#3 Trainer#3 Date#4 Trainer#4 Date#5 Trainer#5 Course

new table
Date Trainer Course

Thanks

Reply With Quote
  #2  
Old April 30th, 2008, 04:01 PM
dykebert's Avatar
dykebert dykebert is offline
Contributing User
Click here for more information. Click here for more information
 
Join Date: Apr 2008
Posts: 200 dykebert User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 Days 3 h 29 m 39 sec
Reputation Power: 1
So you want the data to look like this correct?

new table
Date Trainer Course
Date#1 Trainer#1 Course
Date#2 Trainer#2 Course
Date#3 Trainer#3 Course
Date#4 Trainer#4 Course
Date#5 Trainer#5 Course

If this isn't what the final should be, can you give an example of what the final should be?

Is this a one time thing or do you need to do it regularly?

Reply With Quote
  #3  
Old April 30th, 2008, 10:04 PM
deb40 deb40 is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2008
Posts: 2 deb40 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 20 m 47 sec
Reputation Power: 0
Yes, that example looks good. Unfortunately, it will not be a one time thing.

Reply With Quote
  #4  
Old May 4th, 2008, 09:41 AM
dykebert's Avatar
dykebert dykebert is offline
Contributing User
Click here for more information. Click here for more information
 
Join Date: Apr 2008
Posts: 200 dykebert User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 Days 3 h 29 m 39 sec
Reputation Power: 1
Sorry about the slow reply.
OK the next question is do you always have new data or do you need seperate the data that has already been converted from the new data?

To insert the fields into a new table:

INSERT INTO newTable (Course_Date, Trainer, Course)
(SELECT Date1, Trainer1, Course FROM origTable
UNION
SELECT Date2, Trainer2, Course FROM origTable WHERE Date2 Is Not NULL
UNION
SELECT Date3, Trainer3, Course FROM origTable WHERE Date3 Is Not NULL
...
UNION
SELECT Date8, Trainer8, Course FROM origTable WHERE Date8 Is Not NULL);

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsDatabasesMicrosoft Access Development > Combining multiple fields from one table


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


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





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