I know the OUTER APPLY command is analogous to INNER JOIN, but I'm confused by a situation where this does not happen.
The following query extracted from Training Kit 70-461:
SELECT c.custid
FROM Sales.MyCustomers AS C
CROSS APPLY (SELECT TOP (1) O.shippostalcode
FROM Sales.MyOrders AS O
WHERE O.custid = C.custid
ORDER BY orderdate, orderid) as A;
89 rows are returned.
But when doing the query:
SELECT * from Sales.MyCustomers C
INNER JOIN Sales.MyOrders O
ON c.custid = o.custid
830 rows are returned.
Internal query returns only one row due to TOP:
SELECT TOP (1) O.shippostalcode
Sales.MyOrders AS O, Sales.MyCustomers C
WHERE O.custid = C.custid
ORDER BY orderdate, orderid
Why does CROSS APPLY return 89 rows? What about INNER JOIN 830? If the internal query returns only 1 row this would not be the only value to be compared?