Compare predicates from two different nodes

@MichelDiz I was thinking about allofterms. In my case I have two not connected nodes with different predicates. I like your query. But this is not what is was looking for.
Example: logging_status has logger_name string predicate.

{
  query(func: has(logging_status)) 
  {
      logger_name // 'john' , 'mike', 'jacho' <= i need to save this result as a variable ex: logger_name_results,
  }

  query2(func: has(loggers)) @filter(allofterms(name, logger_name_results) ) 
  {
     expand(_all_)
  }
}

So I need to get all names from logging_status and check if loggers name matches one of the logging_status logger_name, if they match return all.
Any ideas how to do it?