본문 바로가기

DataBase/Ms Sql

Where 조건에서 Exists 써보기

where 1=1

and exists(

select 1 where @book_nm  = ''

union all

select 1 where @book_nm  <> '' and tb.book_nm like + '%' + @book_nm + '%'

)