我已经有一个结果集,但我对具有相同结果的替代查询感兴趣。他们之间有什么更好或更快的?
insert into [dbo].[Teams] values(1,'First')
insert into [dbo].[Teams] values(2,'Second')
insert into [dbo].[Teams] values(3,'Third')
insert into [dbo].[Teams] values(4,'Fourth')
insert into [dbo].[Teams] values(5,'Fifth')
CREATE TABLE [dbo].[Team_team] (
[id1] [int] NOT NULL,
[id2] [int] NOT NULL
) ON [PRIMARY]
GO
select * from teams;
select t1.id,t2.id from teams t2 cross join teams t1