如何使用sql union在单个查询中获取具有不同列的两个表的值

问题描述:

如何使用sql union

How to get tall the values of two table with different columns in single query using sql union

LECT column_name(s) FROM table1
UNION
SELECT column_name(s) FROM table2;
Note: The UNION operator selects only distinct values by default. To allow duplicate values, use the ALL keyword with UNION.

SQL UNION ALL Syntax

SELECT column_name(s) FROM table1
UNION ALL
SELECT column_name(s) FROM table2;