select
sum(a.totalcnt)
from
表名a
where
a.dt = '${dt}'
and a.data_type = 2
and a.tenant_id in (
select
ct.tenant_id
from
表名ct
where
ct.parent_tenant_id = 1000081679
and ct.dt = '${dt}'
and ct.is_deleted = 0
)
in子查询 支持查询2个表关联的情况