Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Dealing With Many To Many Relationships Expand / Collapse
Author
Message
Posted Wednesday, March 26, 2014 9:27 AM


SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: 2 days ago @ 3:11 PM
Points: 142, Visits: 284
Here's an example of something I'm trying to deal with. There are two sets of data that are unique. Let's say Table 1 consists of Clients. Let's say table 2 consists of Online Services. Both of these are unique. One client can have multiple online services while one online service can have multiple clients. What's the best way to relate these tables? I was thinking of creating a relationship table with unique values so that each table would have a one to many relationship to the relationship table.
Post #1555045
Posted Wednesday, March 26, 2014 10:52 AM This worked for the OP Answer marked as solution


SSChampion

SSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampion

Group: General Forum Members
Last Login: Yesterday @ 2:50 PM
Points: 13,062, Visits: 11,891
JoshDBGuy (3/26/2014)
Here's an example of something I'm trying to deal with. There are two sets of data that are unique. Let's say Table 1 consists of Clients. Let's say table 2 consists of Online Services. Both of these are unique. One client can have multiple online services while one online service can have multiple clients. What's the best way to relate these tables? I was thinking of creating a relationship table with unique values so that each table would have a one to many relationship to the relationship table.


Yes that is the best way to deal with this. Create a table like ClientServices. All it needs is the primary key from Clients and the primary key from OnlineServices.


_______________________________________________________________

Need help? Help us help you.

Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.

Need to split a string? Try Jeff Moden's splitter.

Cross Tabs and Pivots, Part 1 – Converting Rows to Columns
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs
Understanding and Using APPLY (Part 1)
Understanding and Using APPLY (Part 2)
Post #1555088
Posted Wednesday, March 26, 2014 11:02 AM


SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: 2 days ago @ 3:11 PM
Points: 142, Visits: 284
Thanks Sean.
Post #1555093
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse