I
IgorM
Hi
I want to join two tables (by UNION ALL). In order two identify the source
table I'd like to add a column that would contain a table name (typed in in
the query).
So for instance:
Table1
Name, Surname, DateOfBirth
Table2
Name, Surname, DateOfBirth, Address
JoinedTable
Name, Surname, DateOfBirth, Address, Source
I started with:
Select Table2.Name, Table2.Surname, Table2.DateOfBirth, Table2.Address
FROM Table2
UNION ALL
Select Table1.Name, Table1.Surname, Table1.DateOfBirth, NULL
FROM Table1
But I just don't know how to add the fifth column (source) so for the data
that come from table one it would contain (Table1) and from the second
(Table2).
Kind regards
IgorM
I want to join two tables (by UNION ALL). In order two identify the source
table I'd like to add a column that would contain a table name (typed in in
the query).
So for instance:
Table1
Name, Surname, DateOfBirth
Table2
Name, Surname, DateOfBirth, Address
JoinedTable
Name, Surname, DateOfBirth, Address, Source
I started with:
Select Table2.Name, Table2.Surname, Table2.DateOfBirth, Table2.Address
FROM Table2
UNION ALL
Select Table1.Name, Table1.Surname, Table1.DateOfBirth, NULL
FROM Table1
But I just don't know how to add the fifth column (source) so for the data
that come from table one it would contain (Table1) and from the second
(Table2).
Kind regards
IgorM