根据某个字段判断是否添加条件

描述:当字段Column1不为空时,增加条件condition

select *

from table

where (OtherCondition)

   and (Column1 is NULL or (Column1 is not NULL and condition))

如果没有其它条件(OhterCondition),将其去掉即可。

 

posted @ 2015-04-30 17:04  cccliche  阅读(478)  评论(0编辑  收藏  举报