Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7079753
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T06:42:38+00:00 2026-05-28T06:42:38+00:00

I need a join that yields three fields with the same name from two

  • 0

I need a join that yields three fields with the same name from two different tables. When I try to run my sql query, VS gives me the following error.

The objects “PoliticalFigures” and “PoliticalFigures” in the FROM clause have the same exposed names. Use correlation names to distinguish them.

I’ve been trying to use “AS” to distinguish these fields, but I haven’t found a working solution. This is the sql query I’m running:

SELECT Countries.Name AS Country, PoliticalFigures.Name AS President, PoliticalFigures.Name AS VicePresident FROM Countries
LEFT OUTER JOIN PoliticalFigures ON Countries.President_Id = PoliticalFigures.Id
LEFT OUTER JOIN PoliticalFigures ON Countries.VicePresident_Id = PoliticalFigures.Id

If it’s not obvious from the code, these are the tables.

  • Countries: Id, Name, President_Id, VicePresident_Id.
  • PoliticalFigures: Id, Name.
  • Joined table: Country, President, VicePresident

(Note, the tables and fields in my application have different names. I am generalizing them to make this example clearer and hopefully more relevant to others.)

(The tools I’m using are Visual Web Developer 2010 Express and SQL Server 2008 Express.)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T06:42:39+00:00Added an answer on May 28, 2026 at 6:42 am

    Use table aliases for each reference to PoliticalFigures instead:

    SELECT 
      Countries.Name AS Country, 
      P.Name AS President, 
      VP.Name AS VicePresident
    FROM
      Countries
      LEFT OUTER JOIN PoliticalFigures AS P ON Countries.President_Id = P.Id
      LEFT OUTER JOIN PoliticalFigures AS VP ON Countries.VicePresident_Id = VP.Id
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to join two tables from different MySQL (PHP) connection strings and different
I have two tables that I need to join. These are: art id |
I vaguely remember that I need to join the two weird tables to get
I have a scenario where I need to join two SQL tables and am
I need to do a join across two different database servers (IPs 10.0.0.50 and
I need to run a JOIN query on a solr index. I've got two
I have 3 tables that I need to join, these join together fine using
Hello from an SQL nO0b, I have three Select statements I want to join:
I've got a scenario where I need to do a join across three tables.
I need to do a join with a table/result-set/whatever that has the integers n

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.