Home >Database >Mysql Tutorial >How to use mysql union to implement full outer join query

How to use mysql union to implement full outer join query

WBOY
WBOYforward
2023-05-30 18:49:061213browse

1. Union is not a method of multi-table connection query. It combines the query results of multiple query sentences into one result and removes duplicate data.

2. Full outer join queries the data of the left table and the right table, and then connects according to the connection conditions.

Example

# 用左外的A union 右外的B
SELECT * FROM t_category c LEFT OUTER JOIN t_product p ON c.cid = p.cno
union
SELECT * FROM t_category c RIGHT  OUTER JOIN t_product p ON c.cid = p.cno

The above is the detailed content of How to use mysql union to implement full outer join query. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:yisu.com. If there is any infringement, please contact admin@php.cn delete