Solved

Name conflict needs to use correlation names

Posted on 2007-04-02
5
2,883 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

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

This article shows gives you an overview on SQL Server 2016 row level security. You will also get to know the usages of row-level-security and how it works
In the first part of this tutorial we will cover the prerequisites for installing SQL Server vNext on Linux.
Using examples as well as descriptions, and references to Books Online, show the documentation available for date manipulation functions and by using a select few of these functions, show how date based data can be manipulated with these functions.
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

627 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