select a.* from song a
inner join ...附属表1
on ..
inner join ...附属表2
on ..
where songname like '%' + isnull(nullif(@songname,''),songname) + '%'
and AlbumsName like '%' + isnull(nullif(@AlbumsName,''),AlbumsName) + '%'
and Composer = isnull(nullif(@Composer),Composer )
and ...如果 AlbumsName 数据库中值为null 则会出现 AlbumsName is like null 导致数据丢失,如何解决 谢谢~~先在这里谢谢 fcuandy 大哥
inner join ...附属表1
on ..
inner join ...附属表2
on ..
where songname like '%' + isnull(nullif(@songname,''),songname) + '%'
and AlbumsName like '%' + isnull(nullif(@AlbumsName,''),AlbumsName) + '%'
and Composer = isnull(nullif(@Composer),Composer )
and ...如果 AlbumsName 数据库中值为null 则会出现 AlbumsName is like null 导致数据丢失,如何解决 谢谢~~先在这里谢谢 fcuandy 大哥
select a.* from song a
inner join ...附属表1
on ..
inner join ...附属表2
on ..
where (@songname is null or songname like '%' + @songname + '%')
and (@AlbumsName is null or AlbumsName like '%' + @AlbumsName + '%' )
and (@Composer is null or Composer = @Composer)
and ...