use northwind
select distinct em.EmployeeID
from employees as em
inner join EmployeeTerritories as et
on em.EmployeeID = et.employeeid
where e.m.country='uk'
Pay attention on the las line.
As you see it is written "e.m.country" instead of "em.country".
This is a bug in the parser for SQL Server 2000. It is present in SQL Server 2005 also but only in compatibility modes below 90. If your database is in 90 compat mode then you will get an error like:
.Net SqlClient Data Provider: Msg 4104, Level 16, State 1, Line 1
The multi-part identifier "e.m.country" could not be bound.
The behavior is retained in older compat modes for backward compatibility reasons and to ensure that existing code works fine upon upgrade to SQL Server 2005. Hope this clarifies.
No comments:
Post a Comment