tencent cloud

Cloud Log Service

EXCEPT Syntax

다운로드
포커스 모드
폰트 크기
마지막 업데이트 시간: 2026-05-06 19:06:14
The EXCEPT syntax is used to combine the analysis results of two SELECT statements, returning only the rows that exist in the first result set but not in the second.

Syntax Format

* | SELECT [column name(KEY)] FROM table1 EXCEPT 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, EXCEPT retains only one instance of each.

Syntax Example

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




도움말 및 지원

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

피드백