I have two tables with dates as the primary column to join. But, I also need to join based on the value from one column that is partially contained in a column from the other table.
Table 1: date, audience Table 2: date, channel
audience' in table 1 has a value that is partially contained in 'channel' in table 2 like this:
audience = "oldpeople" channel = "oldpeople_email"
There are hundreds of potential 'audience' values and 'channel' values, so I cannot name the values, it has to work dynamically. This is what I have tried that has not worked:
SELECT * FROM table1 left JOIN table2 ON ((table2.Channel like '%table1.audience%') AND (table2.date = table1.date) )