8AQAAANCMnd8BFdERjHoAwE/Cl+sBAAAAtGIR4s1JgEi7Qe8qlaV7EQAAAAAIAAAARABUAFMAAAAQZgAAAAEAACAAAACjmcz+2HBmpif3z/J3nMMd4c7cAxic9jqXPMqcyeOawQAAAAAOgAAAAAIAACAAAADjgMoZv/w6lXaOUuOZBCtUL3DICfh1aZ2zqhitINsvSzAAAADaOA0lcZFFJxjIamQxqeSOCKZ9bUfIFaOsHSK/aFWnk1phHv+NaDXVWXElmdWFdapAAAAAM6izqak7hWbE6OTzTfy83Thkad1Fr7nHTFaVV3hrmOyC+XQ6QJicq7O7ixb+0eYARtnRW1g2RGSPBYaV2HI1UgAQAAANCMnd8BFdERjHoAwE/Cl+sBAAAAtGIR4s1JgEi7Qe8qlaV7EQAAAAAIAAAARABUAFMAAAAQZgAAAAEAACAAAABx/LWdQnnht1k8vf9PpbiVo2Kvj5IZgo0b2oq2pBbmwgAAAAAOgAAAAAIAACAAAACWZCGDEF+0mo+K65rCy9rYI2aI86Mr1MlnFFlEz69jAzAAAAB3CY6eGjkTlNIAKdqq0Nv4qoMNp4wnOypVcXp32/rsRYtte0MK698rh8uV7yF38fRAAAAAQ3PvqVS+c5U2RXYt/pqjisL1ZKIbJyX+smU/k+HHy2GbFkB8dGU01Tu4F/hEqN350IUl3n7dYJqZhLAGbjP2XA0with t1 as(
select a.companyDName[所属],a.Categories1_Name[一级类别],a.Categories2_Name[二级类别],a.ReimbursementAmount,
convert(nvarchar(10), b.finish_time,120)[报销通过时间]
from DingTalk_ReimbursementDetail(nolock) a join DingTalk_Reimbursement(nolock)b on a.ReimbursementId = b.Id
union
select companyDName[所属],Categories1_Name[一级类别],Categories2_Name,a.[PaymentAmount],CONVERT(nvarchar(10),b.finish_time,120) from DingTalk_PaymentDetail a
join DingTalk_Payment(nolock)b on a.PaymentId=b.Id
)
select 报销通过时间,[所属],[一级类别],[二级类别]
,sum(ReimbursementAmount) as 金额 from t1
group by 报销通过时间,[所属],[一级类别],[二级类别],ReimbursementAmount936false20[dbo].[BaseETL_OperatingExpenses]936false3falsefalseTABLOCK,CHECK_CONSTRAINTS2147483647DataSourceViewIDDataSourceViewIDTableInfoObjectTypeTable]]>