SELECT list ownership | SQL Server Performance Forums

SQL Server Performance Forum – Threads Archive

SELECT list ownership

This is a code example from inside sql 2005 querying The first line: SELECT list, ‘EmployeeID’ is explicitly from table Employees But ‘OrderID,CustomerID,OrderDate,RequiredDate’ do not explicitly specified which table or where they are from, O1, O2 or E???
Folks, how do you solve this confusion? ————————————–
SELECT OrderID, CustomerID, E.EmployeeID, OrderDate, RequiredDate
FROM dbo.Employees AS E
JOIN db:confused:rders AS O1
ON OrderID IN
( SELECT TOP(3) OrderID
FROM db:confused:rders AS O2
WHERE O2.EmployeeID = E.EmployeeID
ORDER BY OrderDate DESC, OrderID DESC ) ; ——————
Bug explorer/finder/seeker/locator
——————
quote:Originally posted by xiebo2010cx This is a code example from inside sql 2005 querying The first line: SELECT list, ‘EmployeeID’ is explicitly from table Employees But ‘OrderID,CustomerID,OrderDate,RequiredDate’ do not explicitly specified which table or where they are from, O1, O2 or E???
Folks, how do you solve this confusion? ————————————–
SELECT OrderID, CustomerID, E.EmployeeID, OrderDate, RequiredDate
FROM dbo.Employees AS E
JOIN db:confused:rders AS O1
ON OrderID IN
( SELECT TOP(3) OrderID
FROM db:confused:rders AS O2
WHERE O2.EmployeeID = E.EmployeeID
ORDER BY OrderDate DESC, OrderID DESC ) ; ——————
Bug explorer/finder/seeker/locator
——————

Have you looked at rest of the tables? Thanks, Name
———
Dilli Grg (1 row(s) affected)
]]>