I need to convert the following SQL Query to LLBLGen Code.

Posts   
 
    
heyu52
User
Posts: 21
Joined: 27-Apr-2010
# Posted on: 24-May-2011 06:24:20   

I need to convert the following SQL Query to LLBLGen Code.

select count(1) from stock s where s.item_code in ( select distinct s.item_code from stock s left join STK_ANALYSIS a on s.item_code=a.item_code where a.analysis_code='TEST' ) ;

how can i do it?

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 24-May-2011 06:57:22   

In short, seems like you need to use a DynamicList, or simply you can use GetScalar. For the rest of the query, a FieldCompareSetPredicate for the subquery. See this example: http://www.llblgen.com/TinyForum/Messages.aspx?ThreadID=15548

David Elizondo | LLBLGen Support Team