简体   繁体   中英

Is it possible to retrieve distinct attribute valued records of a custom entity in Dynamics Crm without using sql query?

I want to apply distinct method on attribute values. I tried queryexpression, linq query and fetchxml but I could not find a solution for c#.

For example if I have following records

row1 -> A | E | A  
row2 -> B | D | A  
row3 -> C | C | B  
row4 -> D | B | C  
row5 -> E | A | D
row6 -> E | A | E 

I only want to retrieve row1, row3, row4, row5, row6 and not row2 .

The Distinct command will only work on a per row basis. If you truly wanted it to be a column level distinction, you have two options:

  1. Perform two queries, one that selects on the columns you desire the distinction on and another to retrieve the rest of the columns based on the Id's of the first query -or-
  2. Perform a single query, and use code on the client side to parse out the rows that contain the distinct values you're looking for.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM