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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T20:21:31+00:00 2026-05-11T20:21:31+00:00

Is it possible to UNION queries from tables or views that don’t have any

  • 0

Is it possible to UNION queries from tables or views that don’t have any result in common? What I’m trying to do is combine data from different views into one result. I have

select a,b,null,c from VIEW1, VIEW2 where VIEW1.a = VIEW2.a
UNION
select null,null,z,null from VIEW3

I would like the result to be a,b,z,c. Is this where I would use select from? What does that look like?

select ? from (
select a,b,null,c from VIEW1, VIEW2 where VIEW1.a = VIEW2.a
UNION
select null,null,z,null from VIEW3)

I’m using MS SQL Server and the views do not have primary keys. Thanks so much.

  • 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-11T20:21:31+00:00Added an answer on May 11, 2026 at 8:21 pm

    If I understand your question, you’re probably getting results like this:

    a1, b1, null, c1
    a2, b2, null, c2
    a3, b2, null, c3
    null, null, z1, null
    null, null, z2, null
    null, null, z3, nul
    

    l

    .. but what you’re trying to get are results like this:

    a1, b1, z1, c1
    a2, b2, z2, c2
    a3, b2, z3, c3
    

    Do I understand the problem correctly?

    If this is correct, you’ll need to have a way to join these subqueries together, so that you can tell SQL that the 1’s go together, and the 2’s go together, and so on.

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

Sidebar

Related Questions

I'm trying to SUM two rows obtained from differente SQL queries in UNION, is
I have a union query that's getting the count from two different populations. How
Is it possible to do multiple queries that each return a COUNT(*) and have
Possible Duplicate: What is the difference between Join and Union? How do we combine
Is this possible? Using SQL Server 2005....... SELECT * FROM Data0304 UNION SELECT *
I have 2 sql queries that return results, both contain a contract number, now
I have two tables from two different databases. For example: Table: Articles1 - Database:
im trying to create a sql query, that will detect (possible) duplicate customers in
Is it possible to have an anonymous union with const members? I have the
Is it possible to write union select queries like the following more succintly? select

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.