select c.ClientID,c.Name,case MAX(c.Grade) when 0 then '厂家直营' when 1 then '总代理' when 2 then '省级代理'when 3
then '省级代理' end Grade,MAX(d.CooperationIntention) as CooperationIntention,COUNT(*) as number,
ISNULL(c.IsEmphasis,0) IsEmphasis from SG_Client c inner join SG_Discuss d
on c.ClientID=d.ClientID where c.Leader='wzc' group by c.ClientID,c.Name,c.IsEmphasis
UNION ALL
select c.ClientID,c.Name,case MAX(c.Grade) when 0 then '厂家直营' when 1 then '总代理' when 2 then '省级代理'when 3
then '省级代理' end Grade,MAX(d.CooperationIntention) as CooperationIntention,COUNT(*) as number,
2 IsEmphasis from SG_Client c inner join SG_Discuss d on c.ClientID=d.ClientID where
d.AssistDiscussPeople='wzc' group by c.ClientID,c.Name,c.IsEmphasis

相关文章:

  • 2023-02-01
  • 2021-05-28
  • 2021-12-08
  • 2022-02-10
  • 2021-12-09
  • 2022-12-23
  • 2021-06-17
猜你喜欢
  • 2021-09-02
  • 2022-12-23
  • 2022-12-23
  • 2022-02-15
  • 2022-12-23
  • 2021-09-15
相关资源
相似解决方案