语句:if @qu is not null and @qu <> ' '
set @[email protected]+ '区域 = ' ' '[email protected]+ ' ' ' and '
set @sql=left(@sql,len(@sql)-6)
@sql有值 可以。
但是:改成:
--------
if @qu is not null and @qu <> ' 'or @qu1 is not null and @qu1 <> ' ' or @qu2 is not null and @qu2 <> ' '
set @[email protected]+ ' 区域 in ' '( ' ' '[email protected]+ ' ' ', ' ' '[email protected]+ ' ' ', ' ' '[email protected]+ ' ' ') ' ' and '
set @sql=left(@sql,len(@sql)-6)
@sql 变的没值了。怎么解决。
------解决方案--------------------
不会,帮你顶
------解决方案--------------------
修改如下
if @qu is not null and @qu <> ' '
Begin
set @[email protected]+ '区域 = ' ' '[email protected]+ ' ' ' and '
set @sql=left(@sql,len(@sql)-6)
End
------解决方案--------------------
if (@qu is not null and @qu <> ' ')or (@qu1 is not null and @qu1 <> ' ') or (@qu2 is not null and @qu2 <> ' ')
set @[email protected]+ ' 区域 in ' '( ' ' '[email protected]+ ' ' ', ' ' '[email protected]+ ' ' ', ' ' '[email protected]+ ' ' ') ' ' and '
set @sql=left(@sql,len(@sql)-6)