如何使用一个查询从多个数据库下载所有变量?

I have several tables in which a shared variable is stored. How to get all variables from each table with one query? And how to return all variables as in the example? Is it even possible?

$id1 = BDR::selectBySQL("g","SELECT * FROM i1 WHERE ix='".$this->ixx."' LIMIT 1");
foreach($id1 as $id1) 
{
    $id1 = $id1['idz'];

}
$id2 = BDR::selectBySQL("g","SELECT * FROM i2 WHERE ix='".$this->ixx."' LIMIT 1");
foreach($id2 as $id2) 
{
    $id2 = $id2['idxc'];

}
$id3 = BDR::selectBySQL("g","SELECT * FROM i3 WHERE ix='".$this->ixx."' LIMIT 1");
foreach($id3 as $id3) 
{
    $id3 = $id3['idsd'];

}
return ['id2'=>$id1,'id2'=>$id2,'id3'=>$id3];

If the table have the same schema (same of columnd and corresponding data type) you could use a select union all

  SELECT * FROM i1 WHERE ix='".$this->ixx."' LIMIT 1 
  union all  
  SELECT * FROM i2 WHERE ix='".$this->ixx."' LIMIT 1
  union all 
  SELECT * FROM i3 WHERE ix='".$this->ixx."' LIMIT 1 

In this way you should retrieve a list of rows .. with the desired result and iterating over the result you could obation all the values you need

$idAll = BDR::selectBySQL("g",
    "SELECT * FROM i1 WHERE ix='".$this->ixx."' LIMIT 1 
      union all  
      SELECT * FROM i2 WHERE ix='".$this->ixx."' LIMIT 1
      union all 
      SELECT * FROM i3 WHERE ix='".$this->ixx."' LIMIT 1 ");

foreach($idAll as $row) 
{
    $id[] = $row['idz'];

}

return $id;

you can check the content of $id Array using var_dump($id);

and last if the tables comes form different database on same server you can use an explictit table name eg: db1.i1