Distinct Rows in Entity Collection?

Posts   
 
    
hplloyd
User
Posts: 191
Joined: 29-Oct-2004
# Posted on: 04-Oct-2006 12:47:09   

Hi,

I am still using v1.2005

I have a large table in my database that lists individual orders placed by customers, with each order having an order date field.

I link this table to my customer table to get the customer details

What I need to do is retrieve a collection of customers that have one or more orders between a specified date range.

The problem is that I cannot see how I can get DISTINCT customers because what is being return by the generated SQL is a HUGE list showing a customer entity for each order.

How can I include a DISTINCT clause within my entity collection fetch SQL statement. I have seen that this can be done relatively easily with dynamic lists but I really do not want to move over to dynamic lists if at all possible as this would require a lot of re-coding of my application.

Could I for example do something with the join type?

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39927
Joined: 17-Aug-2003
# Posted on: 04-Oct-2006 13:26:55   

entities are always fetched using DISTINCT, or when distinct isn't usable (because a field in the select list violates distinct due to its type), client-side distinct filtering is performed. So this is build in simple_smile

Frans Bouma | Lead developer LLBLGen Pro
hplloyd
User
Posts: 191
Joined: 29-Oct-2004
# Posted on: 04-Oct-2006 14:59:54   

Aah I see.... I have a text field so I dont get distinct.....I can adjust this thanks

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39927
Joined: 17-Aug-2003
# Posted on: 04-Oct-2006 15:34:11   

hplloyd wrote:

Aah I see.... I have a text field so I dont get distinct.....I can adjust this thanks

Yes you will, the entity fetcher filters out duplicates based on PK, if it has to do that on the client, it will do that simple_smile

Frans Bouma | Lead developer LLBLGen Pro