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 6206805
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T05:30:55+00:00 2026-05-24T05:30:55+00:00

I have two columns on one table that reference the same column on a

  • 0

I have two columns on one table that reference the same column on a second table in order to obtain the name that relates to an specified ID.

Below is the query that I am using that is not working. The two LEFT JOINS on the invTypes causes the problem. I have read and read and have been racking my brain on this. I cannot for the life of me figure out how to make this return the names that belong to the IDs that appear in two separate locations in the main table.

THings to note with out posting the entire database structure (which is huge)

both the typeID and itemTypeID are present on the main table. Each of those references the same typeID column in the invTypes table. The invTypes table contains the name that corresponds to said ID.

Additionally, in the SELECT part of the statement, the typeName comes from the invTypes and the stationName comes from the staStations table.

The main question is, if the invTypes.typeName is referenced two times from two columns, how do i 1: properly join the tables to those two points and 2: how do i tell the difference in the two invTypes.typeName that is to be returned if the two JOIN statements can be made.

SELECT 
`logTime`,`itemID`,`typeName`,`actorName`,`stationName`,`action`,`passwordType`,
`quantity`,`oldConfiguration`,`newConfiguration` 
        FROM eve_container_audit 
        LEFT JOIN invTypes ON eve_container_audit.typeID = invTypes.typeID
        LEFT JOIN invTypes ON eve_container_audit.itemTypeID = invTypes.typeID

        LEFT JOIN staStations ON eve_container_audit.locationID = staStations.stationID
  • 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-24T05:30:57+00:00Added an answer on May 24, 2026 at 5:30 am

    Here’s how to join them just once :

    SELECT 
      `logTime`,
      `itemID`,
      `typeName`,
      `actorName`,
      `stationName`,
      `action`,
      `passwordType`,
      `quantity`,
      `oldConfiguration`,
      `newConfiguration` 
    FROM
      eve_container_audit 
    LEFT JOIN
      invTypes
    ON
      eve_container_audit.typeID = invTypes.typeID and
      eve_container_audit.itemTypeID = invTypes.typeID
    LEFT JOIN
      staStations
    ON
      eve_container_audit.locationID = staStations.stationID
    

    If you need to join them twice, use alias :

    SELECT 
      `logTime`,
      `itemID`,
      `typeName`,
      `actorName`,
      `stationName`,
      `action`,
      `passwordType`,
      `quantity`,
      `oldConfiguration`,
      `newConfiguration` 
    FROM
      eve_container_audit 
    LEFT JOIN
      invTypes
    ON
      eve_container_audit.typeID = invTypes.typeID
    LEFT JOIN
      invTypes invTypes2
    ON
      eve_container_audit.itemTypeID = invTypes2.typeID
    LEFT JOIN
      staStations
    ON
      eve_container_audit.locationID = staStations.stationID
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is it a bad thing to have two xml columns in one table? +
I have a table with two columns and one row, and 100% width across
I have two tables with the same columns, and I need to copy one
I have two tables one named Person , which contains columns ID and Name
I have an ItemComments table that has one column with a foreign key constraint
I have two tables one has a three column composite key. The other needs
I have an excel spreadsheet with two columns, one with a list of exercises
I have an Excel sheet with two column, one is a number , and
I have two columns that are joined together on certain criteria, but I would
I have two columns in my table and the rows are created dynamically. <table

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.