tags:

views:

35

answers:

1

i want to add two tables. But how should i distinguish that which entries is from which table?

table1

col1 
-----
a
b
c

table 2

1
2
3

The result should be:

col1 tablename
----------------
a     table1
b      "
c      "
d     table2
e      "
f      "
+2  A: 
Select Table1.Col1, "Table1" as 'TableName'
From dbo.Table1

Union all

Select Table2.Col1, "Table2" as 'TableName'
From dbo.Table2
Barry