@scotty_walker
To query data from multiple tables using Union in MySQL, follow these steps:
Here's an example to demonstrate the process:
1 2 3 4 5 6 |
SELECT column1, column2 FROM table1 UNION SELECT column1, column2 FROM table2 UNION SELECT column1, column2 FROM table3 ORDER BY column1; |
In the above example, the columns "column1" and "column2" are selected from three different tables: table1, table2, and table3. The UNION keyword combines the results of all three select statements into a single result set. Additionally, the results are sorted by "column1" using the ORDER BY clause.