鉴于: TABLE_1具有以下列的列命名的表: ID ColumnA ColumnB ColumnC 我有SQL查询,其中TABLE_1基于关闭的两次自己加入ColumnA,ColumnB,ColumnC。该查询可能看起来像这样: Select t1.ID, t2.ID, t3.ID From TABLE_1 t1 Left Join TABLE_1 t2 On t1.ColumnA = t2.ColumnA And t1.ColumnB = t2.ColumnB And t1.ColumnC = t2.ColumnC Left Join TABLE_1 t3 On t2.ColumnA = t3.ColumnA And t2.ColumnB = t3.ColumnB And t2.ColumnC = t3.ColumnC ... and query continues …
例如,如果我有这个: n = c(2, 3, 5) s = c("aa", "bb", "cc") b = c(TRUE, FALSE, TRUE) df = data.frame(n, s, b) n s b 1 2 aa TRUE 2 3 bb FALSE 3 5 cc TRUE 那么如何合并两列n,并s进入一个名为新列x,使得它看起来是这样的: n s b x 1 2 aa TRUE 2 aa 2 3 bb …