NOT IN filter statement

Posts   
 
    
shahab74
User
Posts: 1
Joined: 08-Apr-2006
# Posted on: 08-Apr-2006 16:16:02   

Hi I am stuck in figuring it out how to write the syntax for a select statement which is like the following:

Basically I need to return all the businessunits which are critical but are not available in the history table for a requestid=22 and requeststatus=1.

The TSQL statement look like the following:

select businessunitid from businessunit where businessunitid NOT IN (select businessunitid from history where requestid=22 and requeststatusid=1) and critical='1'

This is what I was trying to write sysntax for the filter in :

Dim filter As New PredicateExpression filter.Add(New FieldCompareSetPredicate(DAL.BusinessUnitFieldIndex.BusinessUnitId, Nothing, DAL.HistoryFieldIndex.BusinessUnitId, Nothing, SetOperator.NotEqualAny, Nothing))

any assistance would be most appreciated. Thanks in adavance

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39928
Joined: 17-Aug-2003
# Posted on: 08-Apr-2006 17:19:12   

Use the overload of the constructor which accepts 'negate' which is a boolean, and pass 'true'. See the reference manual for all the overloads of the constructor.

Frans Bouma | Lead developer LLBLGen Pro