SQL statement of dynamic business role based on managers from another business role

We have a dynamic business role that is adding managers of a user with certain attributes. 

The SQL query looks like this: 

(UID_Person in (select p.UID_PersonHead
from Person p
inner join Person m ON m.UID_Person = p.UID_Person
where m.customproperty03 is null AND m.customproperty01 <> 'Finance' AND m.UID_DialogCountry = 'QBM-xxxxxx' AND m.IsInActive = 'FALSE'
))

This SQL statement works but now i would like to add second level managers. In other words, managers of the users in query above.

I'm trying to either adjust the existing SQL for the existing dynamic role or creating another dynamic role where the criteria would be, "managers of Persons in business role X". If someone could help me with this SQL query it would be much appreciated.

Thanks!