sql语句查询问题
select DepartmentName,SectionOffice,(select count(*) ShareScore from tblTaskFlowRecord where OperationType in (2, 3) and a.UseWechatOpenId=UseWechatOpenId) ShareCount
我想求详情,但是a.UseWechatOpenId=UseWechatOpenId这个算出来是所有的,请问怎么展开?
from (select distinct UseWechatOpenId from tblTaskFlowRecord a) a
join SysUser c on a.UseWechatOpenId = c.OpenId
left join tblDepartmentRelation d on c.Mobile = d.Phone