Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MS-Access: Merge two tables "below" each other

I have two tables in my Access-database. They look something like this:

Table1
+--------------+----------+----------+----------+
| Kabelnummer  |  Column1 |  Column2 |  Column3 |         
+--------------+----------+----------+----------+
| 1            |    x     |    x     |    x     |
+--------------+----------+----------+----------+
| 2            |    x     |    x     |    x     |
+--------------+----------+----------+----------+
| 3            |    x     |    x     |    x     |
+--------------+----------+----------+----------+
| 4            |    x     |    x     |    x     |
+--------------+----------+----------+----------+

table2
+--------------+----------+----------+----------+
| Kabelnummer  |  Column1 |  Column2 |  Column3 |        
+--------------+----------+----------+----------+
| 1            |    x     |    x     |    x     |
+--------------+----------+----------+----------+
| 2            |    x     |    x     |    x     |
+--------------+----------+----------+----------+
| 3            |    x     |    x     |    x     |
+--------------+----------+----------+----------+
| 4            |    x     |    x     |    x     |
+--------------+----------+----------+----------+

I need a query that gives me 1 table with the data from table1 added to the data from table2:

TableTotal
+--------------+----------+----------+----------+
| Kabelnummer  |  Column1 |  Column2 |  Column3 | 
+--------------+----------+----------+----------+
| 1            |    x     |    x     |    x     |
+--------------+----------+----------+----------+
| 2            |    x     |    x     |    x     |
+--------------+----------+----------+----------+
| 3            |    x     |    x     |    x     |
+--------------+----------+----------+----------+
| 4            |    x     |    x     |    x     |
+--------------+----------+----------+----------+
| 1            |    x     |    x     |    x     |
+--------------+----------+----------+----------+
| 2            |    x     |    x     |    x     |
+--------------+----------+----------+----------+
| 3            |    x     |    x     |    x     |
+--------------+----------+----------+----------+
| 4            |    x     |    x     |    x     |
+--------------+----------+----------+----------+

The names "Column1", "Column2" and "Column3" are the same in both tables

like image 269
Gutanoth Avatar asked Jul 29 '13 12:07

Gutanoth


1 Answers

SELECT *
FROM  Table1

UNION

SELECT *
FROM table2;
like image 130
Matthias Avatar answered Sep 21 '22 02:09

Matthias