Query to select unbalanced accounting entries on all the databases

Use this query to select unbalanced accounting entries on all the databases:

Select [DBList].[LogicalName], [DBList].[DBId], [GLPeriod].[Name], [GLMovement].[EntryNumber] From ([GLMovement] INNER JOIN [GLPeriod] ON ([GLMovement].[GLPeriodId] = [GLPeriod].[Id] and [GLMovement].[DBId] = [GLPeriod].[DBId])) INNER JOIN [LicenceTest11X].[DeMaSy].[DBList] ON [GLMovement].[DBId] = [DBList].[DBId] Group by [DBList].[LogicalName], [DBList].[DBId], [GLPeriod].[Name], [GLMovement].[EntryNumber] having (floor((Sum([GLMovement].[Amount] * (case when [GLMovement].[CD] = 'D' then 1 else 0 end)) - Sum([GLMovement].[Amount] * (case when [GLMovement].[CD] = 'C' then 1 else 0 end)))*10000) <> 0 and floor((Sum([GLMovement].[Amount] * (case when [GLMovement].[CD] = 'C' then 1 else 0 end)) - Sum([GLMovement].[Amount] * (case when [GLMovement].[CD] = 'D' then 1 else 0 end)))*10000) <> 0) Union All Select [DBList].[LogicalName], [DBList].[DBId], [GLPeriod].[Name], [GLMovement].[EntryNumber] From (([GLMovement] INNER JOIN [GLPeriod] ON ([GLMovement].[GLPeriodId] = [GLPeriod].[Id] and [GLMovement].[DBId] = [GLPeriod].[DBId])) LEFT JOIN [GLAccount] ON ([GLMovement].[GLAccountId] = [GLAccount].[Id] and [GLMovement].[DBId] = [GLAccount].[DBId])) INNER JOIN [LicenceTest11X].[DeMaSy].[DBList] ON [GLMovement].[DBId] = [DBList].[DBId] where [GLAccount].[Id] Is Null Group by [DBList].[LogicalName], [DBList].[DBId], [GLPeriod].[Name], [GLMovement].[EntryNumber]