Cross Server Joins - 2
SELECT REM.prod_id, COUNT(*) AS orders,
SUM ( REM.quantity ) AS qty,
FROM NTSERV_sales_order_items REM, local_product LOC
WHERE REM.prod_id = LOC.id
GROUP BY REM.prod_id, LOC.name;
Notes:
The product_id, total number and quantity of orders comes from the other server NTSERV, while the product name comes from a local table. There's nothing special about this SELECT; the proxy table NTSERV_sales_order_items is treated as if it exists locally. The connection to the other server is made automatically.