Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Multi part identifier could not be bound

Status
Not open for further replies.

captphan

Programmer
Jan 24, 2007
42
I am brand new to SQL server and am getting the following error

textMsg 4104, Level 16, State 1, Line 1
The multi-part identifier "dbo.XDS_Shift.userid" could not be bound.
Msg 4104, Level 16, State 1, Line 1
The multi-part identifier "XDS_Location.userID" could not be bound.
Msg 4104, Level 16, State 1, Line 1
The multi-part identifier "XDS_Shift.UserID" could not be bound.colored text


This is my Query
Code:
SELECT 
	XDS_Shift.ShiftStartTime AS [Date], 
	XDS_User.lastname  AS [User Name], 
	XDS_Shift.ShiftStartTime AS [Clock IN], 
	XDS_Shift.MilesTraveledOnShift AS [Total GPS  Miles],
	XDS_Location.EventDetail AS [Clock in comment]
WHere 
	((XDS_Shift.userid = XDS_Location.userID) and (XDS_Shift.UserID = User.UserID))
GROUP BY 
	XDS_Shift.ShiftStartTime, [xds_User].[lastname], XDS_Shift.ShiftStartTime, XDS_Shift.MilesTraveledOnShift
HAVING 
	(((XDS_Shift.ShiftStartTime)>=5/1/2008) AND ((XDS_Shift.MilesTraveledOnShift)<>0))
ORDER BY 
	[xds_User].[lastname];

I understand that it has something to do with alias but I am not sure how.


I am glad I don't know it all because then I would be bored
-Obie
 
You are missing your [!]From[/!] clause.

-George

"The great things about standards is that there are so many to choose from." - Fortune Cookie Wisdom
 
You're also going to have problems with this:

(XDS_Shift.ShiftStartTime)>=5/1/2008

SQL Server will interpret 5/1/2008 as a math operation. 1 divided by 5 divided by 2008. Since these are integers, it will evaluate to 0. Instead, you should use apostrophes and while you're at it, use an un-ambigious date format. Like this...

Code:
(XDS_Shift.ShiftStartTime)>='20080501'



-George

"The great things about standards is that there are so many to choose from." - Fortune Cookie Wisdom
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top