I need to join multiple tables, but the column I need to join on has wildcards for one of the tables columns. The tables are not overly large so it doens't need to be very efficient.
In the Table1 KEY column below there could be any single alphanmueric character where the question marks are. In the Brackets are OR statements, so it could be 1 or 2 or 3 or 4.
So for example it should join onto rows 1&2 of Table2 since the wildcards would match. But row 3 has a 9 where the OR pattern only has 1|2|3|4.
I was thinking of duplicating the row for each possible alphanumeric combination where the question marks are, and for each combination in the OR brackets then the join would work - not sure how to do this.
Table1
| KEY | DATA |
| ABC?Y?[1|2|3|4]Z | 99999 |
Table2
| KEY | DATE |
| ABC1YA1Z | 2019/08/14 10:10:10 PM |
| ABCZYB4Z | 2019/08/14 11:11:11 PM |
| ABC1YA9Z | 2019/08/14 12:12:12 PM |
Result Table:
| KEY | DATE | DATA |
| ABC1YA1Z | 2019/08/14 10:10:10 PM | 99999 |
| ABCZYB4Z | 2019/08/14 11:11:11 PM | 99999 |
| ABC1YA9Z | 2019/08/14 12:12:12PM | . |