[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Is there a work for getting the unique values from 2 tables and putting them into another table?

Posted on 2016-10-13
7
Medium Priority
?
44 Views
Last Modified: 2016-10-13
Is there a work for getting the unique values from 2 tables and putting them into another table?
0
Comment
Question by:zimmer9
  • 4
  • 3
7 Comments
 
LVL 66

Expert Comment

by:Jim Horn
ID: 41842715
Yes, there is 'a work'.  To demonstrate how to pull that off you'll need to give us 'a data mockup' of both source and destination tables, with a description of what values you're trying to pull.
0
 

Author Comment

by:zimmer9
ID: 41842719
Sorry, I meant "word".
0
 

Author Comment

by:zimmer9
ID: 41842727
as in a word that signifies pulling in the unique values from 2 tables into 1 universal table of unique values.
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 66

Expert Comment

by:Jim Horn
ID: 41842732
Still not sure what the heck you're asking us, so a data mockup would really work well here.

Let me know if this is what you were thinking:  Table Based Access Variables
0
 

Author Comment

by:zimmer9
ID: 41842769
My question is purely one of terminology.

Let's say I have 2 tables comprised of Holidays for different companies as follows:

For example:

table A:              table B:

values                values

Jan  2                  Jan  2
Jan 16                Jan  16
Feb 20               Feb 20
Apr 14    
May 29              May 29
Jul  4                  Jul 4
Sep  4                Sep 4
Oct  9          
                           Nov 11
Nov 23              Nov 23
Dec 25              Dec 25


And I wanted to create another table comprised of the distinct values contained in the 2 tables, is there a terminology for this process. If there isn't, then we can close this question.  :)  

I'm not asking for a SQL statement, just a phrase if I were writing a specification.
0
 
LVL 66

Accepted Solution

by:
Jim Horn earned 2000 total points
ID: 41842777
Since you're asking this question in the SQL Server zone, I'll use that terminology and call this 'UNION all distinct values in two tables'.  Other experts may have slightly different terminology.

SELECT DISTINCT day
FROM (
   SELECT day FROM TableA
   UNION 
   SELECT day FROM TableB) 
WHERE COALESCE(day, '') <> ''

Open in new window


I know you didn't want a SQL statement, but since you're asking we might as well ask that terminology, just to make sure a developer does not mis-understand the requirements.
0
 
LVL 66

Expert Comment

by:Jim Horn
ID: 41842800
Thanks for the grade.  Good luck with your project.
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A Stored Procedure in Microsoft SQL Server is a powerful feature that it can be used to execute the Data Manipulation Language (DML) or Data Definition Language (DDL). Depending on business requirements, a single Stored Procedure can return differe…
Windocks is an independent port of Docker's open source to Windows.   This article introduces the use of SQL Server in containers, with integrated support of SQL Server database cloning.
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
Viewers will learn how to use the INSERT statement to insert data into their tables. It will also introduce the NULL statement, to show them what happens when no value is giving for any given column.
Suggested Courses

829 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question