<p>I have a database with two tables (<code>Table1</code> and <code>Table2</code>). They both have a common column <code>[ColumnA]</code> which is an <code>nvarchar</code>. </p>

<p>How can I select this column from both tables and return it as a single column in my result set?</p>

<p>So I'm looking for something like:</p>

<pre><code>ColumnA in Table1:
a
b
c

ColumnA in Table2:
d
e
f

Result set should be:
a
b
c
d
e
f
</code></pre>

[{'answer_id': 44183, 'author': 'Kevin Fairchild', 'author_id': 3743, 'author_profile': 'https://Stackoverflow.com/users/3743', 'pm_score': 5, 'selected': True, 'text': '<pre><code>SELECT ColumnA FROM Table1 UNION Select ColumnB FROM Table2 ORDER BY 1\n</code></pre>\n\n<p>Also, if you know the contents of Table1 and Table2 will <strong>NEVER</strong> overlap, you can use UNION ALL in place of UNION instead.  Saves a little bit of resources that way.</p>\n\n<p>-- Kevin Fairchild</p>\n'}, {'answer_id': 44186, 'author': 'Joseph Sturtevant', 'author_id': 317, 'author_profile': 'https://Stackoverflow.com/users/317', 'pm_score': 1, 'selected': False, 'text': '<p>Use the <a href="http://msdn.microsoft.com/en-us/library/ms180026.aspx" rel="nofollow noreferrer">UNION</a> operator:</p>\n\n<pre><code>SELECT ColumnA FROM Table1\nUNION\nSELECT ColumnA FROM Table2\n</code></pre>\n'}, {'answer_id': 44189, 'author': 'Haydar', 'author_id': 288, 'author_profile': 'https://Stackoverflow.com/users/288', 'pm_score': 0, 'selected': False, 'text': '<p>You can use a union select: </p>\n\n<pre><code>Select columnA from table1 union select columnA from table2 \n</code></pre>\n'}, {'answer_id': 44191, 'author': 'JesDaw', 'author_id': 4440, 'author_profile': 'https://Stackoverflow.com/users/4440', 'pm_score': 0, 'selected': False, 'text': '<pre><code>SELECT Table1.*, Table2.d, Table2.e, Table2.f \nFROM Table1 JOIN Table2 ON Table1.a = Table2.a\n</code></pre>\n\n<p>Or am I misunderstanding your question?</p>\n\n<p>Edit: It appears I did.</p>\n'}, {'answer_id': 44192, 'author': 'Nathan Fritz', 'author_id': 4142, 'author_profile': 'https://Stackoverflow.com/users/4142', 'pm_score': 0, 'selected': False, 'text': "<p>I believe it's:</p>\n\n<pre><code>SELECT columna FROM table1 UNION SELECT columnb FROM table2;\n</code></pre>\n"}, {'answer_id': 44195, 'author': 'SQLMenace', 'author_id': 740, 'author_profile': 'https://Stackoverflow.com/users/740', 'pm_score': 2, 'selected': False, 'text': '<p>Do you care if you get dups or not?</p>\n\n<p>UNION will be slower than UNION ALL because UNION  will filter out dups</p>\n'}, {'answer_id': 44196, 'author': 'Ethan Post', 'author_id': 4527, 'author_profile': 'https://Stackoverflow.com/users/4527', 'pm_score': 0, 'selected': False, 'text': '<p>In Oracle (at least) there is UNION and UNION ALL, UNION ALL will return all results from both sets even if there are duplicates, where as UNION will return the distinct results from both sets.</p>\n'}, {'answer_id': 44201, 'author': 'Unsliced', 'author_id': 2902, 'author_profile': 'https://Stackoverflow.com/users/2902', 'pm_score': 1, 'selected': False, 'text': "<p>The union answer is <em>almost</em> correct, depending on overlapping values: </p>\n\n<pre><code>SELECT distinct ColumnA FROM Table1\nUNION\nSELECT distinct ColumnA FROM Table2\n</code></pre>\n\n<p>If 'd' appeared in Table1 or 'c' appeared in Table2 you would have multiple rows with them. </p>\n"}]
['https://Stackoverflow.com/questions/44181', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/1980/']