Not in 또는 In

JINU·2024년 2월 3일

where 절에서 not in또는 in으로 select하고 싶은 id를 찾아 낼수 있음.

ex.

select id, name, date
from A_table join date_table using(id)
where date not in 
(select date 
from date_table 
date > 2022-01-01)
and A_table.id = 100

으로한다면 2022년전 데이터까지의 데이터 and 100인 id인 데이터를 가져오게 된다.

0개의 댓글