I use a closed source commercial application that uses an MS-SQL database. I regularly have to query this database myself for various purposes. This means the table and database design is fixed, and I can't do anything about it at all. I just have to live with it. Now I have two tables with the following layouts (abstracted, not to discredit the software/database designer)
t1: ID (int), att1(varchar), att2(varchar), .... attx(varchar)
t2: ID (int), t1_ids(varchar)
Now the contents of this t1_ids
is (shudder) a comma separated list of t1 id's. (for example 12, 456, 43, 675, 54). What I want to do is (you guessed it) join those two tables.
Fortunately for me, these are very small tables, and I don't care about performance in terms of complexity at all (could be O(n^m)
as far as I care).
Ideally I would like to make a view that joins these two tables. I don't have any requirements for inserting or updating, just for select statements. What would be the easiest and clearest (in terms of maintainability) way to do this?