日期:2014-05-18 浏览次数:20568 次
select
book05=case when book05 is null or book05='' then '('+ltrim(str(count(*)))+')'
else
ltrim(str(book05)) + '('+ltrim(str(count(*)))+')' end
from books
group by book05 order by book05
select
book05=case when book05 is null or book05='' --这里出错,book05是数字类型,不能这样
then '('+ltrim(str(count(*)))+')'
else
ltrim(str(book05)) + '('+ltrim(str(count(*)))+')' end
from books
group by book05 order by book05
select
book05=case when book05 is null--这么就行了
then '('+ltrim(str(count(*)))+')'
else
ltrim(str(book05)) + '('+ltrim(str(count(*)))+')' end
from books
group by book05 order by book05
------解决方案--------------------
select
book05=case when isnull(book05,0)=0 then '('+ltrim(str(count(*)))+')'
else
ltrim(str(book05)) + '('+ltrim(str(count(*)))+')' end
from books
group by book05 order by book05
------解决方案--------------------
select
book05=case when book05 is null or book05='' then '('+ltrim(count(*))+')'
else
ltrim(book05) + '('+ltrim(count(*))+')' end
from books
group by book05
order by book05