我在不同的地方發現了這個錯誤,我不知道爲什麼所以我想知道這裏的任何人是否可能有任何線索。這是sql。無法綁定多部分標識
select Intranet.dbo.tblPeople.FirstName,
Intranet.dbo.tblPeople.LastName,
Intranet.dbo.tblPeople.CellPhone
tblActivities.OnSiteSupervisorID,
tblActivities.OffSiteSupervisorID,
tblProjects.projectid,
tblVehicleData.Description AS vehicle,
tblVehicleData.VehicleID,
tblVehicleData.ActivityID as ActivityID,
tblProjects.ProjectName,
tblActivities.numPersons,
tblActivities.Description,
tblActivities.ChannelNumber,
tblActivities.StartDate,
tblActivities.EndDate,
tblActivities.estimatedExitTime,
tblLocations.locationname,
from Intranet.dbo.tblPeople,
smartroadmangement.dbo.tblVehicleData,
smartroadmangement.dbo.tblProjects,
smartroadmangement.dbo.tblActivities
left join smartroadmangement.dbo.tblLocations
on smartroadmangement.dbo.tblActivities.locationId = smartroadmangement.dbo.tblLocations.locationid
left join Intranet.dbo.tblPeople as people
on people.PersonID = smartroadmangement.dbo.tblActivities.OnSiteSupervisorID
left join tblActivities as Activities
on Activities.ActivityID = tblVehicleData.ActivityID
left join tblActivities as Activitiez
on Activitiez.ProjectID = tblProjects.ProjectID
WHERE (smartroadmangement.dbo.tblActivities.StartDate Between '2012-07-15 14:17:09' and '2012-07-15 20:17:09')
AND (smartroadmangement.dbo.tblActivities.EndDate Between '2012-07-15 20:17:09'and '2012-07-15 23:17:09')
哪個標識符有問題? – 2012-07-30 20:44:52
忘了補充我收到這兩行的錯誤。 左加入tblActivities作爲活動上Activities.ActivityID = tblVehicleData.ActivityID 左加入tblActivities作爲Activitiez上Activitiez.ProjectID = tblProjects.ProjectID – Guyver 2012-07-30 20:45:14
我很困惑,爲什麼你在FROM有多個表,然後加入他們明確了。我建議你閱讀這個問題關於你使用隱式連接http://stackoverflow.com/questions/894490/sql-left-join-vs-multiple-tables-on-from-line – hatchet 2012-07-30 20:49:44