Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
SP273
Starting Member
14 Posts |
Posted - 2011-03-10 : 10:02:01
|
| Hi,I have written this simple query:(SELECT [LoadID], [Name], [Emp_Level] FROM dbo.Emplmember emleft outer join dbo.HS_Employerchy scp on scp.Child=em.Namewhere scp.DataStorage NOT IN ('ShareData'))when i run this query it gives me following error:Msg 209, Level 16, State 1, Line 1Ambiguous column name 'LoadID'.when i remove column name loadID query runs fine. I have a column name loadID in my dbo.Emplmember table still it comes up with error. Any clue what might be causing this error?Thanks! |
|
|
russell
Pyro-ma-ni-yak
5072 Posts |
Posted - 2011-03-10 : 10:19:25
|
assuming you want LoadID from the Emplmemr tableSELECT em.[LoadID], [Name], [Emp_Level]FROM dbo.Emplmember emleft outer join dbo.HS_Employerchy scpon scp.Child = em.Namewhere scp.DataStorage NOT IN ('ShareData')If you want it from HS_Employerchy. change the part in red to scp. |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2011-03-10 : 10:46:44
|
| It is always a best practice to qualify column names with table alias if joins are usedMadhivananFailing to plan is Planning to fail |
 |
|
|
|
|
|