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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T11:10:14+00:00 2026-06-03T11:10:14+00:00

Newbie question. I want to do something like: SELECT c1,c2,c3 FROM TABLE t1 UNION

  • 0

Newbie question. I want to do something like:

SELECT c1,c2,c3 FROM TABLE t1
UNION
SELECT c1,c2,c3 FROM TABLE t2 WHERE t1.c1 IS NOT NULL AND t1.c2 IS NULL;

so if I have t1:

c1|c2|c3
1 | a|v1
2 | b|v2

and t2:

c1|c2|c3
1 | a|v3
2 | b|v4
2 | c|v5
3 | d|v6

I would get:

c1|c2|c3
1 | a|v1
2 | b|v2
2 | c|v5

Anybody knows how to do this?

  • 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-03T11:10:18+00:00Added an answer on June 3, 2026 at 11:10 am

    According to SQL Docs, JOIN is faster that SubQueries. try this:

     SELECT c1, c2, c3
     FROM   t1
     UNION
     SELECT b.c1, b.c2, b.c3
     FROM   t1 a inner join t2 b ON
             (a.c1 = b.c1) and (a.c1 = b.c1)
     WHERE  (b.c1,b.c2) NOT IN (SELECT c1,c2 FROM t1)
    

    to prove, see here: http://sqlfiddle.com/#!2/50a4e/23

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

Sidebar

Related Questions

I have a newbie question! I want to do something like this: puts Example.new([a,b,c])
Newbie question. I have Django models that look like this: class Video(models.Model): uploaded_by =
I have a proper newbie SEAM question, I want to redirect the user to
css newbie question - we have a generalized css defined for Table along with
This is a very newbie question. I want to know how to create a
Total newbie question, but I cant figure out what im doing wrong. I want
Ok bit of a newbie type question. I want to use Core Data, together
Newbie question... The objective: I intend to have an HTML text input field as
Newbie question since I'm not up to speed using maven at all. I'm trying
I have a PyMongo newbie question: If collection is a PyMongo Collection and 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.