例如,我想在sql server中創建臨時表,並查詢下面的查詢結果,因爲我已經在下面嘗試查詢但我發現了'
該列「僱員」被多次指定爲「ResultSet`請help.thanks如何在sql server中創建臨時表與多個連接表的結果集
SELECT *
INTO #TempTable
FROM
(
SELECT
Employees.EmployeeID
,Employees.LastName
,Employees.FirstName
,Employees.Title
,Employees.TitleOfCourtesy
,Employees.BirthDate
,Employees.HireDate
,Employees.Address
,Employees.City
,Employees.Region
,Employees.PostalCode
,Employees.Country
,Employees.HomePhone
,Employees.Extension
,Employees.Photo
,Employees.Notes
,Employees.ReportsTo
,Employees.PhotoPath
,Orders.OrderID
,Orders.CustomerID
,Orders.EmployeeID
,Orders.OrderDate
,Orders.RequiredDate
,Orders.ShippedDate
,Orders.ShipVia
,Orders.Freight
,Orders.ShipName
,Orders.ShipAddress
,Orders.ShipCity
,Orders.ShipRegion
,Orders.ShipPostalCode
,Orders.ShipCountry
,Shippers.ShipperID
,Shippers.CompanyName
,Shippers.Phone
,[Order Details].OrderID
,[Order Details].ProductID
,[Order Details].UnitPrice
,[Order Details].Quantity
,[Order Details].Discount
,Products.ProductID
,Products.ProductName
,Products.SupplierID
,Products.CategoryID
,Products.QuantityPerUnit
,Products.UnitPrice
,Products.UnitsInStock
,Products.UnitsOnOrder
,Products.ReorderLevel
,Products.Discontinued
,Categories.CategoryID
,Categories.CategoryName
,Categories.Description
,Categories.Picture
,Suppliers.SupplierID
,Suppliers.CompanyName
,Suppliers.ContactName
,Suppliers.ContactTitle
,Suppliers.Address
,Suppliers.City
,Suppliers.Region
,Suppliers.PostalCode
,Suppliers.Country
,Suppliers.Phone
,Suppliers.Fax
,Suppliers.HomePage
FROM (((((((Northwind.Dbo.Products Products
INNER JOIN
Northwind.Dbo.Categories Categories
ON (Products.CategoryID = Categories.CategoryID))
INNER JOIN
Northwind.Dbo.[Order Details] [Order Details]
ON ([Order Details].ProductID = Products.ProductID))
INNER JOIN
Northwind.Dbo.Orders Orders
ON ([Order Details].OrderID = Orders.OrderID))
INNER JOIN
Northwind.Dbo.Customers Customers
ON (Orders.CustomerID = Customers.CustomerID))
INNER JOIN
Northwind.Dbo.Employees Employees
ON (Orders.EmployeeID = Employees.EmployeeID))
INNER JOIN
Northwind.Dbo.EmployeeTerritories EmployeeTerritories
ON (EmployeeTerritories.EmployeeID = Employees.EmployeeID))
INNER JOIN
Northwind.Dbo.Shippers Shippers
ON (Orders.ShipVia = Shippers.ShipperID))
INNER JOIN
Northwind.Dbo.Suppliers Suppliers
ON (Products.SupplierID = Suppliers.SupplierID)) as ResultSet
問題/問題/錯誤是什麼? – McNets
發現錯誤:'ResultID'列多次指定'EmployeeID'列 –
您不需要'(')' - 內部連接不受操作順序影響 – Hogan