I recently dumped the records from an old CRM into a Navicat (MySQL) database as two tables.
__________________
| table_1: |
|----------------|
| id |
| delimited_col |
------------------
__________________
| table_2: |
|----------------|
| id |
| name |
------------------
Info:
- Table 1:
- table_1.delimited_col consists of concatenated names delimited by ";"
ex of a record: "kevin;nancy;james;bart;delaney"
- table_1.delimited_col consists of concatenated names delimited by ";"
- Table 2:
- table_2.name consists of single names
ex of a record: "kevin"
- table_2.name consists of single names
My Goal:
- Create a join table (table_3) which checks each record in table_1.delimited_col to see if they contain a value from table_2.name.
- If a record in table_1.delimited contains a substring found in table_2.name, add that record from table_1's id and the matching record from table_2's id to the join table_3.
__________________
| join_table: |
|----------------|
| id |
| table_1_id |
| table_2_id |
------------------