Supose you have two tables with the exactly the same columns.
Table1:
Name Type AveSls
A 2 20
B 4 10
C 1 15
Table2:
Name Type AveSls
D 2 8
E 3 15
F 1 12
How do i combine the two tables in SQL server 2008 with a SQL satement so that the combined table looks like this:
Table3:
Name Type AveSls
A 2 20
B 4 10
C 1 15
D 2 8
E 3 15
F 1 12
You need to use the UNION operator. it's very simple to use:
See the following useful links:
You can simply use
UNION ALL
(to get all rows even if they repeat in both tables) orUNION
to get non-repeating rows.Read more about
UNION
on MSDN.You can use,