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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T03:22:25+00:00 2026-05-25T03:22:25+00:00

NOTE : In hindsight, I realize this may seem like a stupid question, but

  • 0

NOTE: In hindsight, I realize this may seem like a stupid question, but I really did research it quite a bit before posting here. It was just one of those “right-under-your-nose” kind of answers, ugh!

I have tried to combine multiple simple lookup tables into one as I’ve been told is common practice. I have combined a table containing Statuses and one containing Priority levels as follows:

StatusPriority( ID, Name )
Projects( ID, ProjectName, StatusID, PriorityID ) --Master table

The values for ID between 1-10 represent my statuses while the values for ID between 11-20 represent the priority levels. If I were to split these into two table they would be:

Status( ID, StatusName )
Priority( ID, PriorityName )

GOAL

What I want to do is query for these values into two different columns in the result set with joins to a master table called “Projects.” I tried the following query, but it doesn’t work:

select ProjectName, Name as Status, Name as Priority
    from Projects p left outer join
    StatusPriority st on p.StatusID = st.Name left outer join
    StatusPriority pr on p.PriorityID = pr.Name

SAMPLE RESULTS

    ProjectName         |  Status       |  Priority
    --------------------|---------------|-----------
    Pick Blueberries    |  on hold      |  medium
    Remodel bathroom    |  in progress  |  low
    Plant garden        |  in progress  |  high
  • 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-25T03:22:26+00:00Added an answer on May 25, 2026 at 3:22 am

    You’re criteria for the joins looks wrong, as p.StatusID I can’t imagine would be equal to st.Name. secondly you need to use your table aliases on the select list:

    select ProjectName, st.Name as StatusName, pr.Name as PriorityName
        from Projects p 
        left join StatusPriority st on p.StatusID = st.ID 
        left join StatusPriority pr on p.PriorityID = pr.ID
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Note: This might seem like a Super User question at first, but please read
Note bene: I realize this is an immensely complicated question with about a million
note: I'm working on wordpress but this isn't a wordpress question. I have a
Note: Originally this question was asked for PostgreSQL, however, the answer applies to almost
Note : The code in this question is part of deSleeper if you want
Note This is not a REBOL-specific question. You can answer it in any language.
Note, this might perhaps be best suited on serverfault.com, but since it is about
Note: I am not sure if this is better here, or at superuser, but
Note: This is a follow-up to an answer on a previous question . I'm
note: This is an expansion (and clarification) of a question I asked yesterday. I

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.