Select [GLAccount].[DBId], [GLAccount].[Number] + ', ' + [GLAccount].[Name], count([GLMovement].[EntryNumber])
from [GLMovement] INNER JOIN [GLAccount]
On ([GLMovement].[GLAccountId] = [GLAccount].[Id] and [GLMovement].[DBId] = [GLAccount].[DBId])
where [GLMovement].[Date] > [GLAccount].[EndDate] and Not [GLAccount].[EndDate] < '01/01/2000'
Group by [GLAccount].[DBId], [GLAccount].[Number] + ', ' + [GLAccount].[Name]
order by [GLAccount].[DBId], [GLAccount].[Number] + ', ' + [GLAccount].[Name]