說我有這樣的一個表:獲取行項目的子集的排列在SQLSERVER表中所有行
idx | a1 | a2 | a3 | b1 | c1
-----------------------------
idx1, a11, a12, a13, b11, c11
idx2, a21, a22, a23, b21, c21
idx3, a31, a32, a33, b31, c31
idx4, a41, a42, a43, b41, c41
,我想行添加到具有列子集的置換表( a1,a2,a3)。例如。 row1會貢獻額外的行,如:
idx | a1 | a2 | a3 | b1 | c1
-----------------------------
idx1, a11, a12, a13, b11, c11
idx1, a11, a13, a12, b11, c11
idx1, a12, a11, a13, b11, c11
idx1, a12, a13, a11, b11, c11
idx1, a13, a11, a12, b11, c11
idx1, a13, a12, a11, b11, c11
and so on for the other original rows...
是我將如何做到這一點在sqlserver?
謝謝:)
很確定你將需要在這裏使用交叉應用,儘管我很困惑你爲什麼要這樣做。 – scsimon
不完全確定你要做什麼,但是你可能想要使用自加入https://www.w3schools.com/sql/sql_join_self.asp。編輯:交叉應用似乎其實非常合適 – EMUEVIL
任何這些爲你工作@reedv? – scsimon