日期:2014-05-18 浏览次数:20905 次
--看看最后一列 select *,isnull(spec,'q') from goods where name ='aa' and spec='q' or name ='aa' and spec is null select *,isnull(spec,'q')= from goods where name = 'aa' and isnull(spec,'q')='q'
------解决方案--------------------
效果一样的,
isnull(spec,'q') 的意思就是 如果spec is null 就默认为 spec ='q'
------解决方案--------------------
isnull(spec,'q') 等价于 case when spec is null then 'q'