|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
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
|
|||
|
|||
|
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. |
![]() |
| Viewing: Dev Shed Forums > Databases > MySQL Help > Joining a table's column to a single field in another table. |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|