where (参数= a and sid is null ) or ( 参数 <> a and name = c )或者 where 1= (case when a=参数 and sid is null then 1 else when 参数 <> a and name = c then 1 else 0)
sql中使用case when来判断。case when name='c' then name else c end