Results 1 to 3 of 3
  1. #1
    Join Date
    Jul 2003
    Posts
    10

    Unanswered: many to many relationship -query

    I have two tables -- projects and employee. There exists a many to many relationship between them. One project may have have more than one employee associated to it. One employee may be invloved in more than one project. The tables are

    projects

    project_id(PK)----------------project
    1----------------------------banking
    2----------------------------webdesign
    3-----------------------------mobile
    4-----------------------------automotive


    employee

    emp_id(PK)---------------------employee
    1--------------------------------vinu
    2--------------------------------joseph
    3--------------------------------kevin
    4--------------------------------Martin

    employee table has other fields also.

    work sheet

    emp_id(PK)--------------------------project_id(PK)
    1------------------------------------1
    1------------------------------------2


    Now I want to update the data so that vinu( emp_id=1) works in project 2,3 and 4. Can anybody help me to build the query please?

    Thanks in advance

  2. #2
    Join Date
    Sep 2003
    Location
    Tejas
    Posts
    3
    Do you plan on setting up a third table (intersection table)? I have attached img file in the post -- see that for an idea.

    Table 1 - Employee Table - Contains all of the employee data

    Table 2 - Project Table - Contains all of the project data

    Table 3 - Emp_Proj Table - Will just store emp_num and proj_num.
    Attached Thumbnails Attached Thumbnails tables.gif  

  3. #3
    Join Date
    Jul 2003
    Posts
    10
    Used the same idea you suggested and solved the problem. Lot of thanks for the solution.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •