34,873
社区成员
发帖
与我相关
我的任务
分享
select
B.BranchId,
sum(case when N.status <> 99 and I.type = 1 then 1 else 0 end) pub_cnt,
sum(case when N.status = 1 and I.type = 1 then 1 else 0 end) confirmed_cnt
from
Branch B
left join News N
on B.BranchId = B.BranchId
left join Items I
on N.itemId = I.itemId
group by B.BranchId