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

  • Home
  • SEARCH
  • 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 8858139
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T14:45:36+00:00 2026-06-14T14:45:36+00:00

This is regarding query in Oracle. I have one master table, which stores id,

  • 0

This is regarding query in Oracle.

I have one master table, which stores id, name and description of the project along with the code(s). The table I used, has more than 4 codes to describe health, status, and etc.
The codes and their descriptions are in the same table , say generic table.

When I do select query on the main table, I have to use subqueries to get the descriptions of the code from the generic table. The query gets larger as I have to do Subquery for each and every codes.

Is there any other way to get the output?

Master Table:
-------
Id: 100

Name:

Desc:
Health: H1

Status: S1

code3: c1

.........

........
........


Generic Table:
--------------
Code Description

H1   red

H2   green

..   ......

S1  Critical

..  ........

..  ........

c1  ........
............
............

For the id 100, I used the query,

    SELECT  ID,
    PROJ_NAME,
    PROJ_DESC,
         (SELECT Description FROM generic WHERE id = P.Health) Health,
         (SELECT Description FROM generic WHERE id = P.status) Code2,
         (SELECT Description FROM generic WHERE id = P.Code3) Code3,
    FROM master P
    WHERE ID in (100);
  • 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-06-14T14:45:37+00:00Added an answer on June 14, 2026 at 2:45 pm

    you can use JOIN instead of SUBQUERY

    SELECT  ID,
            PROJ_NAME,
            PROJ_DESC,
            a.Description AS Health,
            b.Description AS Code2,
            c.Description AS Code3
    FROM    master P
            INNER JOIN generic a
                ON a.id = P.Health
            LEFT JOIN generic b
                ON b.id = P.status
            LEFT JOIN generic c
                ON c.id = P.HCode3
    WHERE p.id = 100
    
    • Join vs. sub-query
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an Oracle 10g table that contains a # of log records. This
I have a problem regarding this query. I want to get the applicant latest
I have a query regarding to find out which is day (in given list)
I have a table which has event-details. New records will be inserted to this
I have been having a query regarding writing unit tests for web methods which
I have a query which is something like this SELECT t.category, tc.product, tc.sub-product, count(*)
One query regarding a Web-Site project in Visual Studio - I did following steps
Regarding this line database::query(DELETE FROM bo WHERE name='{$this->_protected_arr[a1]}' AND email='$_SESSION[email]'); How can I update
I have one query regarding NSDate. I have a date i.e. 2011-10-04 07:36:38 +0000,
Hello everyone please help me out regarding this query which is fetching the data

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.