DISTINCT in TypedView

Posts   
 
    
Posts: 28
Joined: 17-Oct-2004
# Posted on: 20-Feb-2005 08:56:42   

I have a TypedView that contains a one to many relationship. That is, I have a CustomerOrders TypedView that contains each customer's orders. In my query I'd like to return records with DISTINCT customers. For example, if a customer named "Acme" placed 3 orders, I only want 1 record returned not 3.

I realize I could probably create a dynamic typed list, however I was hoping I wouldn't need to resort to this since I would lose some flexibility. Any help would be greatly appreciated.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39933
Joined: 17-Aug-2003
# Posted on: 20-Feb-2005 11:10:22   

If the view returns duplicate rows you can specify false for allowDuplicates in the Fill overload (or the Fetchtypedview overload). DISTINCT is then added to the query if the fields in the view don't violate with DISTINCT (an image blob does for example).

If you want to return a subset of the columns of a typed view, you indeed have to create a dyn. list.

Frans Bouma | Lead developer LLBLGen Pro