Many to many relationship?

前端 未结 3 1532
广开言路
广开言路 2021-01-27 03:09

Guys I am trying to make a simple ticket generation system for my company as a favor. For now, I have a table called tblTicket and another table called tblEng

3条回答
  •  野性不改
    2021-01-27 03:49

    I would suggest making 1-to-Many relationships instead of making many-to-many relationships. You can accomplish this by having a table that maps between your tblTicket and tblEngineer. For Example:

    tblEngineer
    -----------
    (PK) iEngineerID
    
    
    tblTicket
    ---------
    (PK) iTicketID
    
    
    tblTicketEngineerMap
    --------------------
    (PK) iMapID
    (FK) iEngineerID
    (FK) iTicketID
    

    By doing it this way, an Engineer and a Ticker can be in many maps, making two 1-to-Many relationships, and allowing the functionality you seek.

    Check out this thread as to why you should try to avoid many-to-many table designs.

提交回复
热议问题