How to retreive all the records which doesn't exits in the related table

Posts   
 
    
Posts: 87
Joined: 17-May-2011
# Posted on: 20-Jul-2011 12:58:16   

Hi there

I have 3 tables Student, Book, StudentBook Now I want to pick up all those records which doesn't exists int the StudentBookTable(RelatedTable) . Can anyone tell me how to do that?.

i.e select * from students where studentid not in (select studentid from studentbook)

How to do this in self service with EntityCollection

Walaa avatar
Walaa
Support Team
Posts: 14950
Joined: 21-Aug-2005
# Posted on: 20-Jul-2011 15:40:12   

For the "NOT IN" predicate you should use FieldComapreSetPredicate. And make sure to use the overload that accepts the negate parameter (set it to true, to get the NOT).

Posts: 87
Joined: 17-May-2011
# Posted on: 21-Jul-2011 07:00:18   

Thanks buddy simple_smile

Posts: 87
Joined: 17-May-2011
# Posted on: 21-Jul-2011 13:00:14   

Hi there

How can we change database connection while taking the built Gen pro code to the deployement server from development site in self service.

Posts: 87
Joined: 17-May-2011
# Posted on: 21-Jul-2011 13:04:27   

I also want to know if I want to compare the expression generated by two fields what predicate will be used

e.g:-

select * from Student where Student.HeightFeet * 12 + Student.Heightinches >= 172

MTrinder
User
Posts: 1461
Joined: 08-Oct-2008
# Posted on: 21-Jul-2011 18:36:21   

We'll address your connection string question in the other thread that you started - please try to keep threads to one question as it make it much easier for us to keep track of them!

Have a look at the documentation on using field expressions in predicates

http://www.llblgen.com/documentation/3.1/LLBLGen%20Pro%20RTF/Using%20the%20generated%20code/gencode_expressionsaggregates.htm#expressionsinpredicates

Matt

Posts: 87
Joined: 17-May-2011
# Posted on: 22-Jul-2011 09:21:59   

How to do this with the entity collection

Walaa avatar
Walaa
Support Team
Posts: 14950
Joined: 21-Aug-2005
# Posted on: 22-Jul-2011 10:18:54   

That's a predicateExpression and predicateExresions can be used when fetching EntityCollections.