oracle exists 條件查詢

select /*+index(table_a columna)*/ distinct tx_oper_id
from table_a
where not exists(
select *
from
table_b
where b.id=a.id
)

參考Oracle官方說明oracle

https://docs.oracle.com/cd/B19306_01/server.102/b14200/conditions012.htmspa

EXISTS Condition

An EXISTS condition tests for existence of rows in a subquery.code

Description of exists_condition.gif follows
Table 7-11 shows the EXISTS condition.server

Table 7-11 EXISTS Conditionhtm

Type of Condition Operation Example
EXISTS

TRUE if a subquery returns at least one row.blog

SELECT department_id
  FROM departments d
  WHERE EXISTS
  (SELECT * FROM employees e
    WHERE d.department_id 
    = e.department_id);
相關文章
相關標籤/搜索