......sum(case b when ''' + b + ''' then 1 else null end) from bb'
from cc where ......

解决方案 »

  1.   

    case b when ''' + b + ''' then 1 else null end) from bb'
    from cc where ......--这里的''' + b + '''  不会是null吧?
      

  2.   

    表1 
    a         bID
    重要      1
    不重要    2
    狠重要    3表2
    bID            d
    1              2005-10-1
    1              2005-10-4
    3              2005-10-8
    如果where 表2的d<2005-8-1
    重要   不重要  狠重要
    ?        ?       ? 
    ?的地方什么也没有,不是0,,,,为什么