2022-10-21 15:30:59 +02:00
|
|
|
select count(DISTINCT d.id) as count
|
2022-02-04 10:12:15 +01:00
|
|
|
from
|
2022-02-07 10:33:09 +01:00
|
|
|
dsm_services d
|
|
|
|
left outer join dsm_api a on (d.id = a.service)
|
2022-02-04 10:12:15 +01:00
|
|
|
where
|
|
|
|
d.registrationdate >= cast(? as date)
|
2022-09-08 15:32:10 +02:00
|
|
|
and d._typology_to_remove_ like ?
|
2022-02-04 10:12:15 +01:00
|
|
|
and d.registrationdate < a.last_collection_date
|
|
|
|
and d.registeredby is not null
|
|
|
|
and d.managed = true
|
|
|
|
and a.last_collection_total > 0
|
|
|
|
and a.active = true;
|