Solved

Name conflict needs to use correlation names

Posted on 2007-04-02
5
2,876 Views
Last Modified: 2012-05-05
For the following SQL statement I receive an error that state Tables or functions 'Offices' and 'Offices' have the same exposed names. Use correlation names to distinguish them.

SELECT *
FROM Services
INNER JOIN Offices ON CentralOffices.centralOfficeId = Services.startId
INNER JOIN Offices ON CentralOffices.centralOfficeId = Services.endId

Any suggestions on how to go about doing so? TIA.
0
Comment
Question by:CodeParadise
5 Comments
 
LVL 142

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 125 total points
Comment Utility
use table aliases:

SELECT *
FROM Services s
INNER JOIN Offices o1 ON o1.centralOfficeId = s.startId
INNER JOIN Offices o2 ON o2.centralOfficeId = s.endId
0
 
LVL 29

Assisted Solution

by:QPR
QPR earned 125 total points
Comment Utility
SELECT *
FROM Services
INNER JOIN Offices O1 ON CentralOffices.centralOfficeId = Services.startId
INNER JOIN Offices 02 ON CentralOffices.centralOfficeId = Services.endId

would solve the ambiguity... but you don't seem to be joining on the table Offices
Your "on" needs to match a key from services to offices, not CentralOffices
0
 
LVL 4

Author Comment

by:CodeParadise
Comment Utility
Sorry, my code should be

SELECT *
FROM Services
INNER JOIN CentralOffices ON CentralOffices.centralOfficeId = Services.startId
INNER JOIN CentralOffices ON CentralOffices.centralOfficeId = Services.endId

I'll give the suggestions a shot right now.
0
 
LVL 4

Author Comment

by:CodeParadise
Comment Utility
Thanks for help guys. It's much appreciated.
0
 

Expert Comment

by:scollege
Comment Utility
Doesn't work for me. Get the error:

The multi-part identifier "[table.column]" could not be bound.
0

Featured Post

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Join & Write a Comment

Performance is the key factor for any successful data integration project, knowing the type of transformation that you’re using is the first step on optimizing the SSIS flow performance, by utilizing the correct transformation or the design alternat…
Everyone has problem when going to load data into Data warehouse (EDW). They all need to confirm that data quality is good but they don't no how to proceed. Microsoft has provided new task within SSIS 2008 called "Data Profiler Task". It solve th…
Via a live example combined with referencing Books Online, show some of the information that can be extracted from the Catalog Views in SQL Server.
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now