Apply OS: Windows, macOS, Linux

Apply Navicat Product: Navicat for MySQL, Navicat for PostgreSQL, Navicat for Oracle, Navicat for SQL Server, Navicat for SQLite, Navicat for MariaDB, Navicat Premium

Apply Navicat Version No.: All


UNION is used to combine the result from many SELECT statements into one result set. Selected columns listed in corresponding positions of each SELECT statement should have the same type. UNION statement example:

(SELECT a FROM tbl_name WHERE a=10 AND B=1 ORDER BY a LIMIT 10)
UNION
(SELECT a FROM tbl_name WHERE a=11 AND B=2 ORDER BY a LIMIT 10)
ORDER BY a;

In Query, click "New Query" icon. In the Query Editor, input your UNION query, then click "Run" to execute the statement.

Note: UNION is available from MySQL 4.0.0 on.

Have more questions?
Submit Ticket