You can use the UNION operator to combine multiple SELECT queries into a
single query in MySQL. The UNION operator allows you to merge the results of two or more SELECT
statements into a single result set.
Here is the basic syntax for using UNION:
SELECT column_name(s) FROM table_name1
UNION
SELECT column_name(s) FROM table_name2;In this example, you would replace "column_name(s)" with the actual names of the columns
you want to select, and "table_name1" and "table_name2" with the actual names of the
tables you want to query.
Note that when using UNION, the column names and data types of the SELECT statements in
each query must match. You can also use the UNION ALL operator to combine the results of
two or more SELECT statements, including duplicate values.
Here is an example of using UNION to combine the results of two SELECT queries:
SELECT name, age FROM users
UNION
SELECT name, age FROM employees;
This would return a result set that includes the name and age columns from both the "users" and
"employees" tables, merged together into a single result set.