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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T13:04:34+00:00 2026-05-23T13:04:34+00:00

Forgive me, I am new to mysql I have this mysql table: |ID|KeyID1|KeyID2|Param|Value|… |asdf|1|2|

  • 0

Forgive me, I am new to mysql

I have this mysql table:

|ID|KeyID1|KeyID2|Param|Value|...
|asdf|1|2| ...

The KeyID1 and KeyID2 values exist another Table like this:

|KeyID|Real Name|
| 1   | Gordon 
| 2   | Jason 

I want to be able to join the two tables together such that I would have ID|Real Name1|Real Name2|Param|Value

what would i need to do in mysql? Would I need to duplicate another table?

edit: i can change the database design

  • 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-23T13:04:35+00:00Added an answer on May 23, 2026 at 1:04 pm

    This is a classic JOIN operation:

    SELECT ID, tab1.RealName as RealName1, tab2.RealName as RealName2, Param, Value
           FROM mytable JOIN nametable AS tab1 ON (mytable.KeyID1 = tab1.KeyID)
                        JOIN nametable AS tab2 ON (mytable.KeyID2 = tab2.KeyID) ;
    

    I’m assuming that your first table is called mytable and that the name lookup table is called nametable, and I also removed the spaces from column names.

    Whenever you need to replace a foreign unique identifier by values from the corresponding lookup table, it’s time for a JOIN on that lookup table. If you do it multiple times from the same table, you can use aliases (AS) to disambiguate which instance you are referring to.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Forgive me for the upcoming question, lol. (Im terribly new at this) I have
Forgive me guys, new to Ruby, actually this is the first lang I have
Forgive me, I'm new to Java and have an extremely basic question. I have
New to all this so forgive my ignorance. I am trying to figure out
Forgive me if this question has been asked before but I am new to
I am new to both EF and Ninject so forgive me if this does
I'm new to most of this so forgive me if I'm doing something really
New to mysql and php, so forgive any obvious stupidity, please! One of mysql
Still new to LINQ2SQL so please forgive my ignorance ... I have one user
I'm new to C# and so forgive me if I have some of my

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.