How to get distinct records in Entity Collection in self service

Posts   
 
    
Posts: 87
Joined: 17-May-2011
# Posted on: 05-Jul-2011 11:25:57   

Hi I need to retrieve all students by like clause on multiple fields but distinctivly. For e.g. select distinct(StudentId),*,State.StateName from Student where Student.Name like '%john%' or Student.FatherName like '%john%' left join State on Student.StateId = State.StateId

Please tell me how to do this in self service??

Walaa avatar
Walaa
Support Team
Posts: 14995
Joined: 21-Aug-2005
# Posted on: 05-Jul-2011 11:44:35   

I'm not sure I follow you.

Distincit is applied to the entire row, Distinct can\t be applied to a field, that's a database rule. If this is what you are asking for.

You can have more than one predicate added to a PredicateExpression, and in your case you will need to use AddWithOr() to add the second predicate.

Posts: 87
Joined: 17-May-2011
# Posted on: 05-Jul-2011 15:08:45   

Yes I wan't to get distinct rows i.e. distinct entities in entitycollection

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39908
Joined: 17-Aug-2003
# Posted on: 05-Jul-2011 17:38:18   

Entities are always fetched using distinct, i.e. you can't get duplicate entities when fetching them.

Frans Bouma | Lead developer LLBLGen Pro