去除条件
select * from Vblog_UserBase where id=
(select UserID from Vblog_UserTags where IsDeleted=0 and Sourcetype=0 and tags='天天')
如果and tags='' 也就是说‘’里面为空 那么条件就去除
怎么写
(select UserID from Vblog_UserTags where IsDeleted=0 and Sourcetype=0 and tags='天天')
如果and tags='' 也就是说‘’里面为空 那么条件就去除
怎么写
作者: jj_li 发布时间: 2011-06-10
SQL code
and tags=case when @tj='' then tags else @tj end
作者: maco_wang 发布时间: 2011-06-10
(select UserID from Vblog_UserTags where IsDeleted=0 and Sourcetype=0 and case when tags='' then '天天' else tags end ='天天' )
作者: happyflystone 发布时间: 2011-06-10
isnull(nullif(tags,''),'天天' ) = '天天'
作者: happyflystone 发布时间: 2011-06-10
SQL code
and tags=case when @tj='' then tags else @tj end
作者: abcjun188 发布时间: 2011-06-10
SQL code
isnull(nullif(tags,''),'天天' ) = '天天'
作者: fredrickhu 发布时间: 2011-06-10