5
SQL Select花费太多时间执行
这是从临时表中进行的简单选择,左键将现有表保留在其主键上,其中两个子选择使用前1个引用联接表。 在代码中: SELECT TempTable.Col1, TempTable.Col2, TempTable.Col3, JoinedTable.Col1, JoinedTable.Col2, ( SELECT TOP 1 ThirdTable.Col1 -- Which is ThirdTable's Primary Key FROM ThirdTable WHERE ThirdTable.SomeColumn = JoinedTable.SomeColumn ) as ThirdTableColumn1, ( SELECT TOP 1 ThirdTable.Col1 -- Which is also ThirdTable's Primary Key FROM ThirdTable WHERE ThirdTable.SomeOtherColumn = JoinedTable.SomeColumn ) as ThirdTableColumn2, FROM …