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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T02:37:07+00:00 2026-06-18T02:37:07+00:00

Is it possible to join the results of 2 sql SELECT statements as one

  • 0

Is it possible to join the results of 2 sql SELECT statements as one statement where both are query the same tables, and look for values in the same column?

I want to have the id of a task (which is fine) but then I want to filter out certain values into 2 separate columns.

Currently I get get the data in 2 separately:

 SELECT id, string_value as Station FROM table WHERE datatype= 'station'

(column datatype doesn’t need to be seen)

returns something like:

id            Station
task1         station1
task2         station2

and then I have

SELECT id, string_value as RespondingAction FROM table 
 WHERE datatype='RespondingAction'

returning:

id             RespondingAction
task1          Approve
task2          Decline

I want to basically combine these 2 queries, but I’m not sure how as they both look for the data in the same column. Hopefully the end result would be something like this:

id            Station           RespondingAction
task1         station1          Approve
task2         station2          Decline 
task3         station1          Decline
task4         station3          Pending (if null)

Sorry if this isn’t too clear; I’m new to this and trying my best to work this out!

  • 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-18T02:37:08+00:00Added an answer on June 18, 2026 at 2:37 am
    SELECT id, MAX(Station), NVL(Max(RespondingAction), 'Pending')
    FROM
      (SELECT id, 
        string_value as Station,
        NULL as RespondingAction
       FROM table
       WHERE dataType = 'station'
    
       UNION
    
       SELECT id,
        NULL as Station,
        string_value as RespondingAction
       FROM table
       WHERE dataType = 'RespondingAction')
    GROUP By id
    

    EDIT

    you can also try to replace

    NVL(Max(RespondingAction), 'Pending')
    

    by

       COALESCE(MAX(RespondingAction), CAST('Pending' AS <the type of column string_value>))
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is it possible to join the results of 2 sql SELECT statements in one
I have an sql query pulling a few results from different tables, one of
Is it possible to do a join to a nested select statement in SubSonic
I am basically having the exact same problem as here: SQL View: Join tables
We need to create a view that combines both these SQL statements together. SELECT
Is it possible to order the results of an SQL query, on a field
Right now I do two separate SQL statements, one doing a SELECT COUNT(*) on
I've got a SQL query running a FULL JOIN on multiple database tables. The
Is is possible to programatically join two tables using Django's ORM? I have two
Possible Duplicate: how to join 2 tables I am very new to databases. 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.