The difference between using UNION ALL and UNION to display records correctly.
I recently needed data from multiple tables with the same column name to be displayed in the same ROW.
There are two ways to perform this action. [UNION ALL] and [UNION]. I found that if you use [UNION ALL], it lists all rows but duplicates the top Select statement.
[Examples]
[_00TabOne] had the following data.
ID
Ordered
1
3
1
5
1
8
1
10
[_00TabTwo] had the following data.
ID
Ordered
1
1
1
2
1
4
1
6
1
7
1
9
The above two tables have the following columns in common. [Ordered] and [ID]. So, in our SQL Query, we would do something like this.