Get common parent node

Okay,

Your employees are 0x9c672b and 0x9c672c.

{
  var(func: uid(0x9c672c)) {
   A_BOSS as  ~boss_of # In this case you have to use reverse edges
  }
  var(func: uid(0x9c672b)) {
   B_BOSS as  ~boss_of 
  }
    
    query(func: uid(A_BOSS)) @filter(uid(B_BOSS)){
      uid
      boss_of {
        uid
      }
    }
}

This query above will return only if the bosses are the same. Otherwise will be “Your query did not return any results”.

Other case

If you have the boss UID and wanna check who has him as boss. You could use “uid_in”. e.g:

The boss UID is 0x679de1

{
  q(func: eq(section_company, "payment"))
   @filter(uid_in(~boss_of, 0x679de1)){ 
   # Now you can filter at root by the parent node via "boss_of" edge. 
   # In this case you have to use reverse edges
    name
    somethingElse
  }
}

See about reverse edges

This query above you gonna have all employees in payment sector but with common boss.