This question already has an answer here:
The question I asked before is as follows. Last question
Table 1 -- ID pairs table
Table 2 -- Attribute table
Table 3
For example, id1 and id2 have different color and size, so the id1 and id2 row(2nd row in Table 3) has "id1 id2 0 0";
id1 and id3 have same color and different size, so the id1 and id3 row(3nd row in Table 3) has "id1 id3 1 0";
Same attribute---1 Different attribute---0
But, what if I do not know how many attribute columns in Table2; how can I make it? Such as I do not know the column name color or size. Maybe there is another column called brand. Then how can I get Table3?
The following solution should work for any unknown number of attributes in
Table2
. I have edited the answer from your Last QuestionThe final output is
The solution should work for any unknown number of attributes.