select
p.*,
cpm.id as idCustomerPaymentMethod
from Project as p
inner join CustomerPaymentMethod as cpm
on cpm.idCustomer=p.idCustomer
where p.automaticCharge='1'
and p.cutoff<='2025-09-28'
and cpm.status='1'
and EXISTS(
select *
from Movement as m
where m.idObj=p.id
and m.objType='2'
and m.registered between '2025-09-23 15:39:53' and '2025-09-28 15:39:53'
and m.status='1'
)
group by p.id
0