我可以使用DCount()来查找不同“ID”的数量吗? [英] Can I use DCount() to find number of different "ID"

查看:99
本文介绍了我可以使用DCount()来查找不同“ID”的数量吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图找出一种方法(我今天早上似乎陷入困境)在表格中找到不同BeneficiaryID的计数,然后用该数字划分2个字段。


让我进一步解释。


这是典型的数据行:

I am trying to figure out a way (I seem to be stuck in a rut this morning) to find the Count of different BeneficiaryID in a table, and divide 2 fields by that number.

Let me explain further.

Here''s a typical row of data:

展开 | 选择 | Wrap | 行号

推荐答案

除非您传递 QueryDef 的名称,该名称将记录分组或使用 SELECT DISTINCT

DCount()(和域聚合函数一般)不能e SQL作为参数。
Not unless you pass the name of a QueryDef which either groups the records or uses SELECT DISTINCT.

DCount() (and Domain Aggregate functions generally) cannot take SQL as the Domain parameter.


感谢您的回复,NeoPa。


您怎么看待去另一条路线。在进入受益人表时,对每个[EmployeeID]的所有[BeneficiaryID]使用DCount()我正在运行查询,并在我在OP中询问的查询中使用它?
Thanks for the reply, NeoPa.

What do you think of going another route. As in going to the Beneficiary Table, using DCount() for all [BeneficiaryID]''s per [EmployeeID] I am running the queries for, and using that in the query I am asking about in my OP?


上下文就是Mark。通常我会在查询中避免使用域聚合函数。每次调用都必须设置并清除必须运行的查询。 SQL的效率基于这样一个事实:它可以一次完成多个操作,只需设置一次。反复使用 D ...()函数会丢失所有这些。


如果不了解您的上下文,我只能说它看起来像一个非常糟糕的方法。它有可能是最好的。但极不可能; - )
Context is everything Mark. Generally I avoid Domain Aggregate functions from within a query. Each call has to set up and clear a query that has to be run. The efficiency of SQL is based in the fact that it can do multiple operations all together in a single go with the overhead of setting it up just once. Repeated use of D...() functions loses all this.

Without an understanding of your context I can only say it looks like a very bad approach. It''s possible that it''s the best available. Highly unlikely though ;-)


这篇关于我可以使用DCount()来查找不同“ID”的数量吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆