Join on a function call?

Posts   
 
    
tomahawk
User
Posts: 169
Joined: 02-Mar-2005
# Posted on: 05-Nov-2008 20:38:12   

Is it possible in LLBLGen v2.6 to JOIN on a function call, like so:

LEFT JOIN fn_ContactCodeList() d ON d.ContactID=c.ContactID

[edit] I was thinking I could wrap the function call in a Derived Table, but when I look at your sample code, I only see examples where there is ONE join, that to the Derived Table. It seems to me that if I add an appropriate DynamicRelation to my relations collection (which includes non-dynamic relations), then setting the relationscollection.SelectListAlias to reference to the derivedTable would throw the rest of the joins off? Or am I wrong? Either way, how can I accomplish a SELECT that includes (but not exclusively) a join on a derived table?

Thanks, Josh

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39616
Joined: 17-Aug-2003
# Posted on: 06-Nov-2008 15:42:29   

It's currently not possible to specify a function as the target of a field, so that it ends up in the SQL (instead of a table/view name).

You can join to a derivedtable as long as the aliases match. The examples you saw were likely written when v2.6 was released as we after release had to add this feature in for Linq as it was possible to write Linq queries to join to derived tables which in turn joined to other derived tables.

Frans Bouma | Lead developer LLBLGen Pro