Объединить данные с двух баз mysql + mssql

Вывожу с mysql так

 <?     mysqli_select_db($link, 'ukmserver');
    $result = mysqli_query($link, "SELECT card, pos, shift_open, local_number, 
           date, amount, tori.item, tori.quantity, 
           tori.receipt_header 
    FROM trm_out_receipt_header torh   
    INNER JOIN trm_out_receipt_item tori  ON (torh.id=tori.receipt_header and torh.cash_id = tori.cash_id) 
    LEFT JOIN trm_out_receipt_payment torp ON (torh.id=torp.receipt_header and torh.cash_id=torp.cash_id) 
    where torh.card IN ('229456', '229455') 
    group by date
    ");   ?>

 <? while ($row = mysqli_fetch_assoc($result)) {
 echo " <tr><td> {$row['card']}</td><td> {$row['pos']}</td>
 <td> {$row['shift_open']}</td><td> {$row['local_number']}</td><td> {$row['date']}</td>
                <td>_000000146</td>
              <td>Ленина 8</td>
               
                     <td></td>
                          <td></td>

                <td>{$row['item']}</td>
                  <td>{$row['quantity']}</td>
<td>{$row['amount']}</td> 
             </tr>  ";

    
}  ?>

Подключился к ms sql и как мне сделать чтобы данные были сопоставимы по tori.item(mysql) = items.item_id (mssql) причем выгрузка с ms sql идет всех товаров вообще, а заказов естественно меньше

$conn = sqlsrv_connect($serverName, $connectionOptions);

$tsql = "SELECT items.item_id, items.id_group, item_groups.tree
         FROM items, item_groups where 
         item_groups.id_group = items.id_group
         ";  
 


$stmt = sqlsrv_query( $conn, $sql);

if( $stmt === false)  
{  
     echo "Error in query preparation/execution.\n";  
     die( print_r( sqlsrv_errors(), true));  
}  
  
/* Retrieve each row as an associative array and display the results.*/  
 
/* Free statement and connection resources. */  
sqlsrv_free_stmt( $stmt);  
sqlsrv_close( $conn); 

Ответы (0 шт):