A1VBCode Forums

Database Design


http://www.a1vbcode.com/vbforums/Topic27379.aspx

By victor64 - 4/4/2009

Hello,

I am having difficulties designing a database with data from table 1 referencing multiple data in table 2. For example:

Table 1 includes:

id   Title

1    105MM   

2    155MM


Table 2 includes:

id    Country

1     BEL

2     CAN

3     FRA

4.    ITA

How do I design both Tables in order to link Table 1 with multiple records in Table 2?.

For example when I select 105MM, I want to see all the records from Table 2 that pertains to 105MM. I am trying to avoid duplicating the coutrires in table 2 just to link to the id column in table 1.

Output Example:

105MM
   - BEL
   - CAN
   - ITA

155MM
   - BEL
   - FRA
   - ITA

I think I need to add other columns in Tables 1 and 2 because if I only use the ID columns from both tables, I will only link to table 2 where the ID columns match in both tables. I want to be able to see multiple records in table 2 that applies to a record in table 1. For example when selecting 105MM in table 1, I want to see
BEL, CAN,ITA from tablle. Those same countries may also be linked with other titles in table 1.

Thanks,

Victor

By vb5prgrmr - 4/5/2009

tblTitle

iTitleID

vTitle

 

tblCountry

iCountryID

iTitleID

vTitle

 

Granted, prefix of tbl=table, i=number(includes autonumber), v=text, the create relation between tblTitle (table1) iTitleID and tblCountry (table2) iTitleID

 

Good Luck