大漠孤烟丶 2017-09-30 02:47 采纳率: 0%
浏览 659

求助 这sql怎么写?????????????????????

select 'notcanceled' as id, 'recordId' as pId, c.catalog, count(c.catalog) as cCount,

'计数('+cast(count(c.catalog) as varchar(10))+')' as name , 'false' as [open]

from (
select record_id, logout_flag,r.catalog_id, '否' as catalog
from [elePermit].dbo.permit_catalog c
left join [dbo].[generate_record] r
on c.catalog_id=r.catalog_id
where c.original_flag = '正本'
and r.logout_flag = '否'
) as c
group by c.catalog


from里查询没有数据,但是我想让count显示0
怎么改???

图片说明

  • 写回答

3条回答 默认 最新

  • jiegemena 2017-09-30 04:06
    关注

    count(isnull(c.catalog,0)) as cCount

    评论

报告相同问题?