总结查询? [英] Summing Queries?
问题描述
我正在跟踪大约40种不同的缺陷。我希望所有的这些缺陷都按月和按年分别计算。我想
在报告中显示这些结果。我知道我可以创建40个查询(一个用于
每个缺陷)只有两个字段,计数和缺陷,并计算
字段,但这听起来很多工作。
有没有办法可以做得更简单快捷?
我的数据库有两个字段,一个叫做count。 (输入一个数字
来计算缺陷数量)。第二个字段称为缺陷
描述 (输入缺陷类型的地方)。
谢谢,
Don ..........
I have about 40 different defects I''m tracking. I''d like to have all of
these defects totaled individually, both by month and by year. I''d like to
show these results in a report. I know I could create 40 queries (one for
each defect) with just the two fields, count and defect, and sum the count
field but that sounds like a lot of work.
Is there a way I can do this much simpler and quicker?
My database has two fields, one is called "count" (where a number is entered
to count the number of defects). The second field is called "Defect
Description" (where the defect type is entered).
Thanks,
Don..........
推荐答案
Don Sealer写道:
Don Sealer wrote:
我有大约40种不同的缺陷我正在跟踪。我希望所有这些缺陷都按月和按年分别计算。我想在报告中显示这些结果。我知道我可以创建40个查询(一个用于
每个缺陷)只有两个字段,count和defect,并计算
字段,但这听起来像是很多工作。
是有一种方法我可以做得更简单,更快捷吗?
我的数据库有两个字段,一个叫做count。 (输入一个数字来计算缺陷的数量)。第二个字段称为缺陷
描述。 (输入缺陷类型的地方)。
I have about 40 different defects I''m tracking. I''d like to have all of
these defects totaled individually, both by month and by year. I''d like to
show these results in a report. I know I could create 40 queries (one for
each defect) with just the two fields, count and defect, and sum the count
field but that sounds like a lot of work.
Is there a way I can do this much simpler and quicker?
My database has two fields, one is called "count" (where a number is entered
to count the number of defects). The second field is called "Defect
Description" (where the defect type is entered).
----- BEGIN PGP签名消息-----
哈希:SHA1
你的意思是你的表有2列(又名字段)。数据库有表格;
表格有列。
这样的东西:
SELECT DefectDescription,SUM( DefectCount)AS缺陷
来自table_name
GROUP BY缺陷描述
-
MGFoster :: :mgf00< at> earthlink< decimal-point> net
奥克兰,加利福尼亚州(美国)
-----开始PGP SIGNATURE -----
版本: PGP个人隐私5.0
Charset:noconv
iQA / AwUBQzcbF4echKqOuFEgEQIeawCfcTJ5SqfDRWUjvcIpcBGxEo EjvDMAoNch
N4RrRKNg5lUcDomgY3aFr7AY
= L7Nm
-----结束PGP SIGNATURE -----
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
You mean your table has 2 columns (aka fields). A database has tables;
tables have columns.
Something like this:
SELECT DefectDescription, SUM(DefectCount) AS Defects
FROM table_name
GROUP BY DefectDescription
--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)
-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv
iQA/AwUBQzcbF4echKqOuFEgEQIeawCfcTJ5SqfDRWUjvcIpcBGxEo EjvDMAoNch
N4RrRKNg5lUcDomgY3aFr7AY
=L7Nm
-----END PGP SIGNATURE-----
我了解Field vs column。考虑到这一点,我需要一些
的额外帮助。
其实我的数据库有很多列。其中两个是缺陷计数&
缺陷描述。
如何编写此查询?我已经尝试了几种不同的方法,但我保持
获取错误,语法等。这就是我有的但是它不起作用。
我怎么能按月和按年分类?
再次感谢你的帮助和指导,
Don ...........
SELECT缺陷描述,总和(缺陷数)AS缺陷
FROM [数据收集表];
按缺陷描述的组
MGFoster < me@privacy.com>在消息中写道
news:vW **************** @ newsread2.news.pas.earthli nk.net ...
I understand about Field vs column. With that in mind I need some
additional help.
Actually my database has many columns. Two of them are Defect Count &
Defect Description.
How do I write this query? I''ve tried several different ways but I keep
getting errors, syntax and such. Here''s what I''ve got but it''s not working.
Also how could I sort this by month and then by year?
Thanks again for your help and guidance,
Don...........
SELECT Defect Description, sum(Defect Count) AS defects
FROM [Data Collection Table];
Group by Defect Description
"MGFoster" <me@privacy.com> wrote in message
news:vW****************@newsread2.news.pas.earthli nk.net...
Don Sealer写道:
Don Sealer wrote:
我有大约40种不同的缺陷我正在跟踪。我希望所有这些缺陷都按月和按年分别计算。我希望
在报告中显示这些结果。我知道我可以创建40个查询(每个缺陷一个
),只有两个字段,count和defect,并将
count字段相加,但这听起来像是很多工作。
是有一种方法我可以做得更简单,更快捷吗?
我的数据库有两个字段,一个叫做count。 (输入数字是
来计算缺陷数)。第二个字段称为缺陷
描述。 (输入缺陷类型的地方)。
I have about 40 different defects I''m tracking. I''d like to have all of
these defects totaled individually, both by month and by year. I''d like to show these results in a report. I know I could create 40 queries (one for each defect) with just the two fields, count and defect, and sum the count field but that sounds like a lot of work.
Is there a way I can do this much simpler and quicker?
My database has two fields, one is called "count" (where a number is entered to count the number of defects). The second field is called "Defect
Description" (where the defect type is entered).
-----开始PGP签名消息-----
哈希:SHA1
你的意思是你的表有2列(又名字段)。数据库有表格;
表格有列。
这样的东西:
SELECT DefectDescription,SUM(DefectCount)AS缺陷
FROM table_name
GROUP BY缺陷描述
-
MGFoster ::: mgf00< at> earthlink< decimal-point> net
奥克兰,加利福尼亚州(美国)
-----开始PGP签名-----
版本:PGP个人隐私5.0
Charset:noconv
iQA / AwUBQzcbF4echKqOuFEgEQIeawCfcTJ5SqfDRWUjvcIpcBGxEo EjvDMAoNch
N4RrRKNg5lUcDomgY3aFr7AY
= L7Nm
-----结束PGP SIGNATURE -----
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
You mean your table has 2 columns (aka fields). A database has tables;
tables have columns.
Something like this:
SELECT DefectDescription, SUM(DefectCount) AS Defects
FROM table_name
GROUP BY DefectDescription
--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)
-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv
iQA/AwUBQzcbF4echKqOuFEgEQIeawCfcTJ5SqfDRWUjvcIpcBGxEo EjvDMAoNch
N4RrRKNg5lUcDomgY3aFr7AY
=L7Nm
-----END PGP SIGNATURE-----
我明白了。我没有正确输入。它非常好用,谢谢你
为了按月和年分类,最好是按月创建一个查询
和按年查询另一个查询?是否可以在一份报告中同时显示两个
?
再次感谢您的帮助,
Don ..... .........
" Don Sealer" < VZ ****** @ verizon.net>在消息中写道
news:yxGZe.1957
I got it. I didn''t type it correctly. It works very well thank you
In order to sort these by month and year would it be best to create a query
by month and another query by year? Would it be possible to show both of
these in a single report?
Thanks again for your help,
Don..............
"Don Sealer" <vz******@verizon.net> wrote in message
news:yxGZe.1957
这篇关于总结查询?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!