Can i create a temporary table on mySQL, with the result of a query made to table in a DB2 database?
So then i can do a Join with a mySQL table ?
Something like ?
create temporary table tmp_foo AS select * from table_db2;
SELECT * FROM table_a LEFT JOIN tmp_foo ON table.id = tmp_foo.id
In this moment i do this. Wich generates many mySQL conections, and is very slow.
// DB2 connection
$db = ADONewConnection (TIPO_DB);
$db->PConnect (CONN_HOST, $_SESSION['user'], $_SESSION['pwd'], CONN_DB);
$db->SetFetchMode (ADODB_FETCH_ASSOC);
// connection to mySQL
$db2 = ADONewConnection (TIPO_DB_WEB);
$db2->PConnect (CONN_HOST_WEB, $_SESSION['user'], $_SESSION['pwd'], CONN_DB_WEB);
$db2->SetFetchMode (ADODB_FETCH_ASSOC);
//query to DB2 dabatase via ODBC
$sql = "SELECT insnum FROM INSFIL";
$sql = $sql . " WHERE insfei BETWEEN '$fecha_inicio' AND '$fecha_termino'";
$sql = $sql . " AND (insest='004' OR insest='006')";
$sql = $sql . " ORDER BY insnum";
$rs = $db->execute($sql);
while($as400 = $rs->FetchRow()){
$sql2 = "SELECT inspecciones.num AS insnum, fotos.id AS id_foto, fotos.foto";
$sql2 = $sql2 . " FROM inspecciones LEFT JOIN fotos";
$sql2 = $sql2 . " ON inspecciones.id = fotos.id_inspeccion";
$sql2 = $sql2 . " WHERE inspecciones.num = '$insnum'";
$sql2 = $sql2 . " AND inspecciones.completado = 0";
$rs2 = $db2->execute($sql2);
while($row = $rs2->FetchRow()) {
//CODE
}// end while MySQL
}//end while AS400
thanks in advance