Updating multiple tables in sql server
You can also use such a combination of tables to restrict your results without actually returning columns from every table.
By default, the UNION statement will omit duplicates between the tables unless the UNION ALL keyword is used.
Also, neglecting to define the nature of the correlation with a WHERE clause can give you undesirable results, such as returning the rogue field in a column associated with every possible result from the rest of the query, as in a CROSS JOIN.
If you’re comfortable with how your database handles this type of statement, and you’re combining two or just a few tables, a simple SELECT statement will meet your needs.
There are several types of JOIN—LEFT, RIGHT, and FULL OUTER; INNER; and CROSS.
The type you use is determined by the results you want to see.