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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T20:56:44+00:00 2026-05-25T20:56:44+00:00

Alright, need some help created a query for an Oracle 10g DB. I have

  • 0

Alright, need some help created a query for an Oracle 10g DB. I have a table to looks like this:

----------------------------------------
| lowerBound | upperBound | locationId |
----------------------------------------
|      0     |     99     |     1      |
----------------------------------------
|     100    |    199     |     2      |
----------------------------------------
...

Another table looks like this:

-----------------------------
| locationId | locationCode |
-----------------------------
|     1      |     12345    |
-----------------------------
|     2      |     23456    |
-----------------------------
|     3      |     34567    |
-----------------------------
...

I start with a number, say 113, but it is a variable figured out in java. I need to figure out the locationId that corresponds to that number, based on it falling between the lowerBound and upperBound columns, and then join that to figure out the locationCode in the 2nd table. I’ve looked up things like MIN/MAX and between, however I am not finding exactly what I am looking for. I am not a good DBA, so any help is 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-25T20:56:44+00:00Added an answer on May 25, 2026 at 8:56 pm
    SELECT t2.locationCode
      FROM table1 t1
     INNER JOIN table2 t2 USING(locationId)
     WHERE 113 BETWEEN t1.lowerBound AND t1.upperBound
    

    If the USING part puzzles you:

    SELECT t2.locationCode
      FROM table1 t1
     INNER JOIN table2 t2 ON t2.locationId = t1.locationId
     WHERE 113 BETWEEN t1.lowerBound AND t1.upperBound
    

    Note that this will work if your lowerBound and upperBound columns are INTEGERS. If they are VARCHAR, you will have to use the TO_NUMBER function of course.

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

Sidebar

Related Questions

Alright I have an xml document that looks something like this: <xml> <list> <partner>
Alright zeroclipboard experts, I need some help. I have a popup context menu and
Alright guys, Need some help! Im working with asp.net mvc3 razor (and am fairly
Alright, so I have a text file with some data in it, in this
Alright, I'm working on a Droid app and need some help. I need to
I need some help, I created an iPhone App and it works great, I
Alright, I have received some helpful information on this personal site I am working
Alright, I have some data that I need to assign an int type identifier
I need some help at understanding how foreign keys and cascades work. I understood
Alright, i have read many different views on how to do this with no

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.