DECLARE @set1 table
(
UserName nvarchar(256)
)
DECLARE @set2 table
(
UserName nvarchar(256)
)
INSERT INTO @set1 VALUES('1')
INSERT INTO @set1 VALUES('2')
INSERT INTO @set1 VALUES('3')
INSERT INTO @set1 VALUES('4')
INSERT INTO @set2 VALUES('1')
INSERT INTO @set2 VALUES('2')
INSERT INTO @set2 VALUES('3')
INSERT INTO @set2 VALUES('4')
--SELECT * FROM Crossjoin(@set1,@set2)
SELECT * FROM @set1 set1
CROSS JOIN @set2 set2 ORDER BY set1.UserName
交叉联接