简体   繁体   English

是否可以在不使用sql查询的情况下在Dynamics Crm中检索自定义实体的不同属性值的记录?

[英]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#. 我尝试使用queryexpression,linq查询和fetchxml,但找不到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 . 我只想检索row1, row3, row4, row5, row6而不是row2

The Distinct command will only work on a per row basis. Distinct命令仅适用于每行。 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- 执行两个查询,一个查询选择您想要区分的列,另一个查询根据第一个查询的ID检索其余的列-或者-
  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. 执行一个查询,然后在客户端使用代码解析包含所要查找的不同值的行。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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