In SQL Server, we can combine the same type of data from multiple tables using SET operators. After combining multiple SQL statements, it returns one result set. Following is the list of T-SQL SET operators:
- UNION ALL
To use SET operators, we must follow a number of rules:
- The result set of both queries must have the same number of columns.
- The data type of columns retrieved by the top and bottom queries must be the same.
- If we want to sort the final result set, the ORDER BY clause must be at the end of the query.
- The positional ordering of the columns returned by the top and bottom queries must be same. Read More