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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T04:28:34+00:00 2026-05-30T04:28:34+00:00

I have a two tables, one that contains basic resource info, with columns and

  • 0

I have a two tables, one that contains basic resource info, with columns and values like:

enter image description here

And a separate table of exta associated values with columns and data like:

enter image description here

What I am trying to do is write a SQL query that will join both and produce a result that is ordered by the “order” key, like so:

enter image description here

I am not sure how to make my join work so that I can both pull the location values and then SORT by the order values from that same table.

And before you ask, no I can’t redesign the db schema, I have to work with this. Any help greatly appreciated!

  • 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-30T04:28:36+00:00Added an answer on May 30, 2026 at 4:28 am

    Try this

    SELECT t1.RESOURCE_NO
           ,t1.NAME
           ,t2.VALUE
           ,t3.VALUE -- Included so that you can "see" the value
      FROM table1 t1
     INNER JOIN table2 t2
        ON t1.RESOURCE_NO = t2.RESOURCE_NO AND t2.[KEY] = 'location'
     INNER JOIN table2 t3
        ON t1.RESOURCE_NO = t3.RESOURCE_NO AND t3.[KEY] = 'order'
     ORDER BY t3.VALUE ASC
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two tables, one that contains volunteers, and one that contains venues. Volunteers
I have two tables, one that contains nodes and second that contains the relationships
I have two tables that have the same structure; one contains permanaent data, and
I have two tables one named Person , which contains columns ID and Name
I have two tables, one contains data like this: link_id | counted ================= 1--------|
Suppose I have two tables that are linked (one has a foreign key to
I have two tables, one for routes and one for airports. Routes contains just
I have two tables, one is a table of forum threads. It has a
I have two tables as follows: I have a RatingsTable that contains a ratingname
I have two long list, one from a log file that contains lines formatted

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.