Who knows how?

From the table:


Table1 Field1 Field2 1 1--- 2 2--- 3 3--- ... 

Make a table:


 Table1 Table1 Field1 Field2 Field1 Field2 1 1--- 1 1--- 2 2--- <-> 2 2--- 3 3--- 3 3--- ... ... 

What would be the table:


 Table1_1 Field1 Field2 1 1--- 1 2--- 1 3--- ... 2 1--- 2 2--- 2 3--- ... 3 1--- 3 2--- 3 3--- ... 

Without cursors !!! It is necessary to request if there is such an opportunity.
Thank!

    1 answer 1

    I did not understand the logic by which the rows in this table are selected - do you need field1 and field2 to match?

     WITH t(field1) AS ( SELECT DISTINCT Field1 FROM Table1 WHERE field1 = field2 ) SELECT * FROM t t1 CROSS JOIN t t2 
    • It works, thanks!!! - Acne
    • 2
      There was such a Dutch mathematician Brower - the founder of intuitionism. He wrote his works in Dutch, and when his works were translated into English, they would necessarily make a postscript - they say that Brower really had in mind - Dunno, but I (the translator) understood this. And here I understood that, but what did you really mean - I don't know - renegator
    • Field1 and Field2 should not match, but your answer works for my task - Acacia