计算非0的记录 [英] Counting records that are not 0

查看:56
本文介绍了计算非0的记录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个查询,我想要计算其中值为

的字段txtFactClients的记录数。不是0.我设置了一个表达式CountFC:

txtFactClients在总计行中选择了计数,在标准行中选择[txtFactClients]> 0

,但是当我运行查询时,它会计算每个记录是否

是否为0我看过上一篇文章,但它们似乎都涉及到了
SQL,有没有办法在查询的设计模式下这样做?

TIA

Tony

解决方案

Tony,


在你做任何事之前先试试这个:在SQL视图中查看您的查询。

Access中的设计查询允许您在SQL,Design

和数据表视图之间轻松切换。把它充分用到它。您可以在SQL

视图中执行任何操作,您可以在设计视图中执行此操作,反之亦然(尽管某些内容比其他内容更容易做到)。


如果您无法解决如何做某事,请切换到SQL View,将SQL

复制到ng,并准确说出结果你要的那个。当你得到

答案时,将SQL复制回SQL View中的新查询。然后切换回

Design View(如果需要)。恕我直言,在两者之间来回切换是最好的学习方法之一。并不是说Access生成的SQL是完美的,但它确实有效。


Darryl Kerkeslager

" Tony Williams" < tw@tcpinvalid.com>在消息中写道

news:cs ********** @ titan.btinternet.com ...

我有一个我想要查询的查询字段txtFactClients的值
的记录数。不是0.我已经设置了一个表达式CountFC:
txtFactClients在总计行中选择了计数,在标准行中选择了
[txtFactClients]> 0,但是当我运行查询时,它会计算每条记录
,无论它是否为0.我看过以前的发布但它们似乎都涉及到SQL,有没有办法在查询的设计模式中这样做?
TIA
Tony



您需要从

字段的条件行中删除[txtFactClients]> 0" CountFC:txtFactClients"并添加字段txtFactClients,

在总行中选择''where'并在标准行中选择>。


Mike


txtFactClients可能是一个TEXT字段,因此有字符串值,不是
NUMBERS。


尝试:

[txtFactClients]<>" 0"

作为您的标准。


-Ed


" Darryl Kerkeslager" <柯********* @ comcast.net>在消息中写道

新闻:5v ******************** @ comcast.com ...

Tony ,

在您执行任何其他操作之前尝试此操作:在SQL视图中查看您的查询。
在Access中按设计查询允许您在SQL,Design之间轻松切换/>和数据表视图。把它充分用到它。你可以在SQL视图中做任何你可以在设计视图中做的事情,反之亦然(虽然有些事情比其他事情更容易做到)。

如果您无法解决如何做某事,请切换到SQL View,将
SQL
复制到ng,并准确说出您想要的结果。当您得到答案时,请将SQL复制回SQL View中的新查询。然后切换回
Design View(如果需要)。恕我直言,在两者之间来回切换
是最好的学习方式之一。不是说Access生成的SQL是完美的,但它确实有效。

Darryl Kerkeslager

Tony Williams < tw@tcpinvalid.com>在消息中写道
新闻:cs ********** @ titan.btinternet.com ...

我有一个查询,我想计算记录数

字段txtFactClients的值
不是0.我已经设置了一个表达式CountFC:
txtFactClients在总计行中选择了计数,并且


[txtFactClients]> 0

在标准行中,但是当我运行查询时,它会计算每条记录

是否为0.我看过上一篇文章但是他们似乎都涉及到SQL,有没有办法在设计模式下做到这一点查询?
TIA
Tony




I have a query that I want to count the number of records where the value of
a field "txtFactClients" is not 0. I have set up an expression "CountFC:
txtFactClients" with Count selected in the Total line and [txtFactClients]>0
in the criteria line but when I run the query it counts every record whether
or not it is 0. I''ve looked at previous post but they all seem to involve
SQL, is there a way of doing this in the design mode of a query?
TIA
Tony

解决方案

Tony,

Try this before you do anything else: Look at your query in SQL view. The
Query By Design in Access allows you to switch easily between SQL, Design
and Datasheet view. Put it to it''s full use. You can do anything in SQL
view that you can do in Design View, and vice-versa (although some things
are easier to do in one than the other).

If you can''t work out how to do something, switch to SQL View, copy the SQL
to the ng, and say exactly the results that you want. When you get your
answer, copy the SQL back to a new query in SQL View. Then switch back to
Design View if you want. IMHO, switching back and forth between the two is
one of the best ways to learn. Not that the SQL that Access generates is
perfect, but it works.

Darryl Kerkeslager
"Tony Williams" <tw@tcpinvalid.com> wrote in message
news:cs**********@titan.btinternet.com...

I have a query that I want to count the number of records where the value of a field "txtFactClients" is not 0. I have set up an expression "CountFC:
txtFactClients" with Count selected in the Total line and [txtFactClients]>0 in the criteria line but when I run the query it counts every record whether or not it is 0. I''ve looked at previous post but they all seem to involve
SQL, is there a way of doing this in the design mode of a query?
TIA
Tony



You need to remove [txtFactClients]>0 from the criteria line of your
field "CountFC:txtFactClients" and add the field txtFactClients,
choosing ''where'' in the total line and >0 in the criteria line.

Mike


txtFactClients is probably a TEXT field and as such has string values, NOT
NUMBERS.

Try:
[txtFactClients] <>"0"
as your criteria.

-Ed

"Darryl Kerkeslager" <Ke*********@comcast.net> wrote in message
news:5v********************@comcast.com...

Tony,

Try this before you do anything else: Look at your query in SQL view.
The
Query By Design in Access allows you to switch easily between SQL, Design
and Datasheet view. Put it to it''s full use. You can do anything in SQL
view that you can do in Design View, and vice-versa (although some things
are easier to do in one than the other).

If you can''t work out how to do something, switch to SQL View, copy the
SQL
to the ng, and say exactly the results that you want. When you get your
answer, copy the SQL back to a new query in SQL View. Then switch back to
Design View if you want. IMHO, switching back and forth between the two
is
one of the best ways to learn. Not that the SQL that Access generates is
perfect, but it works.

Darryl Kerkeslager
"Tony Williams" <tw@tcpinvalid.com> wrote in message
news:cs**********@titan.btinternet.com...

I have a query that I want to count the number of records where the value


of

a field "txtFactClients" is not 0. I have set up an expression "CountFC:
txtFactClients" with Count selected in the Total line and


[txtFactClients]>0

in the criteria line but when I run the query it counts every record


whether

or not it is 0. I''ve looked at previous post but they all seem to involve
SQL, is there a way of doing this in the design mode of a query?
TIA
Tony




这篇关于计算非0的记录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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