MS SQL Query for Meditech Data Repository DR GL Account Summary

use MYDATABASE
Select *
from GlAccountAmounts GAA INNER JOIN DMisGlAccount GA
on GAA.AccountID=GA.AccountID
where GAA.AccountID in (

Select GAA.AccountID
from GlAccountAmounts GAAS INNER JOIN DMisGlAccount GAS
on GAA.AccountID=GA.AccountID
Where GAA.AccountID like '%111111111%'
or GAA.AccountID like '%222222222%'
or GAA.AccountID like '%33333333333%')
and DateTime BETWEEN '2009-09-01 00:00:00.000'
AND
'2009-09-14 00:00:00.000'