Solved

Name conflict needs to use correlation names

Posted on 2007-04-02
5
2,880 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 143

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 125 total points
ID: 18839565
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
ID: 18839567
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
ID: 18839588
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
ID: 18839619
Thanks for help guys. It's much appreciated.
0
 

Expert Comment

by:scollege
ID: 20867589
Doesn't work for me. Get the error:

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

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Split data on commas and insert into another table in separate records 26 70
Are triggers slow? 7 15
Error when creating a table from a function 6 20
SQL View / Qtry 3 13
Let's review the features of new SQL Server 2012 (Denali CTP3). It listed as below: PERCENT_RANK(): PERCENT_RANK() function will returns the percentage value of rank of the values among its group. PERCENT_RANK() function value always in be…
This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
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

820 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