AXForum  
Вернуться   AXForum > Microsoft Dynamics CRM > Dynamics CRM: Blogs
All
Забыли пароль?
Зарегистрироваться Правила Справка Пользователи Сообщения за день Поиск

 
 
Опции темы Поиск в этой теме Опции просмотра
Старый 10.03.2009, 23:05   #1  
Blog bot is offline
Blog bot
Участник
 
25,626 / 848 (80) +++++++
Регистрация: 28.10.2006
Microsoft Dynamics CRM Team Blog: Support for COUNT(DISTINCT) in Fetch XML queries
Источник: http://blogs.msdn.com/crm/archive/20...l-queries.aspx
==============

We have made a couple of enhancements to the aggregate query feature of Fetch XML. These updates have shipped for version 4.0 as part of UR2 and for version 3.0 as documented in KB Article 960079. So far we only supported the count aggregate function which essentially did a count(*) on the base table of the entity.

We have enhanced this functionality to add a new aggregate operation countcolumn which now performs the SQL count operation for a given column. It also support the distinct keyword which only counts unique columns. If the distinct keyword is not specified with a countcolumn aggregate, its value defaults to false.

Here is a table that summarizes the Fetch aggregate types and its equivalent SQL translation:

CRM Fetch XML

SQL


SELECT COUNT(*) AS 'citycount' FROM Account


SELECT COUNT(address1_city) AS 'citycount' FROM Account


SELECT COUNT(DISTINCT address1_city) AS 'citycount' FROM Account



                                                     Key: Existing Feature, New Feature

Here are a couple of examples for using these features:

Query to return a count of all Accounts which have a county specified in their address.

1: Query to return a count of all Accounts which have a county specified in their address. 2: 3: 4: 5: 6:

Query to return a count of states in which we have an account. This uses the distinct keyword which counts a state only once.

1: 2: 3: 4: 5:

Thanks

Noor Merchant

 



Technorati Tags: Code,Tips and Tricks,XML,Dynamics CRM 4.0


Источник: http://blogs.msdn.com/crm/archive/20...l-queries.aspx
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору.
 

Похожие темы
Тема Автор Раздел Ответов Посл. сообщение
Полезные ссылки по MS CRM. IgorF Dynamics CRM: Прочие вопросы 60 24.05.2013 16:19
Microsoft Dynamics CRM Team Blog: List Web Part for Microsoft Dynamics CRM 4.0 Deployment Scenarios Blog bot Dynamics CRM: Blogs 0 30.01.2009 22:05
Microsoft Dynamics CRM Team Blog: Microsoft Dynamics CRM 4.0 Bookshelf Blog bot Dynamics CRM: Blogs 1 22.01.2009 04:46
Microsoft Dynamics CRM Team Blog: Troubleshooting the Microsoft Dynamics CRM E-mail Router Blog bot Dynamics CRM: Blogs 0 09.01.2009 06:03
Microsoft Dynamics CRM Team Blog: Top 14 Microsoft Dynamics CRM Sites and Downloads Blog bot Dynamics CRM: Blogs 0 14.07.2008 13:05

Ваши права в разделе
Вы не можете создавать новые темы
Вы не можете отвечать в темах
Вы не можете прикреплять вложения
Вы не можете редактировать свои сообщения

BB коды Вкл.
Смайлы Вкл.
[IMG] код Вкл.
HTML код Выкл.
Быстрый переход

Рейтинг@Mail.ru
Часовой пояс GMT +3, время: 13:44.