MySQL Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsDatabasesMySQL Help

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:
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now!
  #1  
Old June 9th, 2000, 12:02 PM
murdy murdy is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2000
Posts: 4 murdy User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Here is what I am wanting to do.

I have one table (employees) containing employee information (emp_id, last_name, first_name, dept, phone_num)

I also have a table (workgroups) containing employee workgroup partners (emp_id, last_name, first_name, partner)

The workgroups table will have individual records for all the employees/partners

emp_id...last_name....first_name....partner
100......Smith........Jane..........Barry
100......Smith........Jane..........Susan
101......Hunt.........Barry.........Jane
101......Hunt.........Barry.........Susan
102......Jones........Susan.........Jane
102......Jones........Susan.........Barry

What I would like to do is to join the two tables, using the emp_id fields, to produce the workgroup partners for 'Jane Smith' as a single field in the new table along with the rest of the employee information originally contained in the employee table.

i.e.

(emp_id, last_name, first_name, dept, phone_num, {partners})

I would want the {partners} field at the end of the employee detabase to print out all names in that workgroup on the same row, seperated by a comma. (Jane, Barry)

Can I do this with ENUM? Some type of warped CONCAT statement? Use a temp table somewhere along the way? or is it just much more complicated than that?

I would also like to be able to possibly set precedence for each workgroup partner so that maybe the group leader could be listed first in the new field, followed by the second, third assistants, etc.

maybe by adding another field to the workgroups table? (emp_id, last_name, first_name, partner, partner_rank)And then assigning an int for partner_rank and sorting by the integer.

Any suggestions would be great. I'm doing this with MySQL and PHP. I've also been re-reading through my newriders MYSQL book. Can't get a grasp on how to do it through the book though.

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesMySQL Help > Joining a table's column to a single field in another 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 6 hosted by Hostway