select POPUP_START_DT
, POPUP_END_DT
, date_format(now(),'%Y%m%d')
, case when popup_start_dt > date_format(now(),'%Y%m%d') then '1'
when popup_end_dt < date_format(now(),'%Y%m%d') then '3'
else '2' end as popup_state
from tb_popup;
start_dt 가 현재 시간보다 크면 1
end_dt 가 현재 시간보다 작으면 3
그외 이면 2
'강좌 > Query' 카테고리의 다른 글
(오라클) 여러행을 하나의 컬럼으로 합치기 (0) | 2017.07.14 |
---|---|
오라클 속성이 다른값 검색 (0) | 2017.05.22 |
오라클 ORA-02292: integrity constraint 오류시 (0) | 2016.09.20 |
MySql 에서의 LIKE 문 작성법 (0) | 2015.07.22 |