SQL join to get the cartesian product of 2 columns out of 3 columns
问题 I have the following table: create table #table ( time int, key char(1), val int ) with the following data: insert into #table (time, key, val) values (0,"a",1) insert into #table (time, key, val) values (0,"b",2) insert into #table (time, key, val) values (1,"a",10) insert into #table (time, key, val) values (2,"b",20) and I would like to come up with a join of that will yield the following rows/cols: 0 a 1 0 b 2 1 a 10 1 b 0 2 a 0 2 b 20 Which is basically the cartesian product of the