我现在添加网站点击率的sql
update  新闻 set 点击=点击+1 where  标题='"+title2 +"'"怎么当"点击"那个字段为null是就加不了你呢?一直显示的是null高手指点

解决方案 »

  1.   

    update     新闻   set   点击=isnull(点击,0)+1   where     标题='"+title2   +"'" 
      

  2.   

    update 新闻 set 点击 = isnull(点击,0) + 1 where 标题 = 'title2'
      

  3.   

    update 新闻 set 点击 = isnull(点击,0) + 1 where ....
      

  4.   

    当某个操作数为null值时, 参与什么(算术,字串连,与)运算,结果仍为null. 除了消除null的函数外比如nullif,isnull,count聚合,等等
      

  5.   

    null + 1 --> null