SQL Server 2005 CROSS APPLY

Posts   
 
    
CowHills
User
Posts: 47
Joined: 14-Mar-2007
# Posted on: 12-Jul-2007 14:59:58   

Hi guys,

I'm trying to use a query using CROSS APPLY like this:

SELECT C.CustomerID, O.SalesOrderID, O.TotalDue FROM AdventureWorks.Sales.Customer AS C CROSS APPLY AdventureWorks.dbo.fn_GetTopOrders(C.CustomerID, 3) AS O ORDER BY CustomerID ASC, TotalDue DESC

Is there a way how I can embed this query in a predicate?

By the way, I'm using the adapter scenario.

Thanks in advance,

Gerben Vermeulen

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39749
Joined: 17-Aug-2003
# Posted on: 24-Jul-2007 12:08:43   

Only with a custom relationpredicate bucket class which has its own RelationCollection derived class in where you override the ToQueryText, which forms the FROM clause. It's tricky though, basicly what I'd do is simply formulate a query in a RetrievalQuery object and use that to fetch a projection simple_smile

Frans Bouma | Lead developer LLBLGen Pro