tencent cloud

Cloud Log Service

INTERSECT Syntax

다운로드
포커스 모드
폰트 크기
마지막 업데이트 시간: 2026-05-06 19:05:09
The INTERSECT syntax is used to combine the analysis results of two SELECT statements, and return only the rows that exist in both result sets.

Syntax Format

* | SELECT [column name(KEY)] FROM table1 INTERSECT SELECT [column name(KEY)] FROM table2
The analysis results of each SELECT statement should have the same number of columns and the same field types to be combined.
If the SELECT result contains duplicate rows, INTERSECT retains only one instance of each.

Syntax Example

Combine two tables with only one column to get the rows that exist in both of them. Among them, the first table has only one row with a value of 13, and the second table has two rows with values of -42 and 13, respectively.
* | SELECT * FROM (VALUES 13)
INTERSECT
SELECT * FROM (VALUES 42,13)
Return result:




도움말 및 지원

문제 해결에 도움이 되었나요?

피드백