Get the App
SLTechnology News&Howtos  ›  Database  › 

SqlServer series notes-- Joint query UNIONSqlServer series notes

Shulou Source: shulou.com Published: 2022-06-01 14:51:07 11月16日 Update

Basic principle: each result set must have the same number of columns; the columns of each result set must be of compatible types.

SELECT FName FROM T_Employee UNION

SELECT FName FROM T_TempEmployee

one

SELECT FName FROM T_Employee

UNION ALL

SELECT FName FROM T_TempEmployee

Note: UNION merges two query result sets and merges completely duplicate rows into one. Union is inefficient because it needs to scan duplicate values, so if you are not sure you want to merge duplicate rows, use UNION ALL

Tags: Results notes queries same two principles efficiency data types federation Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Information OPPO Reno vpn Microsoft Shulou Technology