O'Reilly logo
  • Dustin Waybright thinks this is interesting:

Next, suppose that you need to apply this logic to each of the suppliers from Japan that you have in the Production.Suppliers table. You don’t want to use a cursor to iterate through the suppliers one at a time and invoke a separate query for each. Instead, you can use the CROSS APPLY operator like in the following.

SELECT S.supplierid, S.companyname AS supplier, A.*
FROM Production.Suppliers AS S
  CROSS APPLY (SELECT productid, productname, unitprice
               FROM Production.Products AS P
               WHERE P.supplier...


Cover of Training Kit (Exam 70-461): Querying Microsoft® SQL Server® 2012


Note that A.* returns all columns where the right row correlates to the left row.