473,387 Members | 1,925 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

aggregate function error

I have a query where I am grouping by Fiscal Month, Summing # of Quotes,
Summing # of Days.......and created an expression.........Avg Days: [# of
Quotes]/[Days Open].

And I get the following error message.........anyone know why?

"You tried to execute a query that does not include the specified expression
"[# of Quotes]/[Days Open]" as part of an aggregate function.

Both # of Quotes and Days are numerical fields........why can't I divide one
into the other?

Thanks!

--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...ccess/200612/1

Dec 21 '06 #1
4 7950
Lori2836 via AccessMonster.com wrote:
I have a query where I am grouping by Fiscal Month, Summing # of Quotes,
Summing # of Days.......and created an expression.........Avg Days: [# of
Quotes]/[Days Open].

And I get the following error message.........anyone know why?

"You tried to execute a query that does not include the specified expression
"[# of Quotes]/[Days Open]" as part of an aggregate function.

Both # of Quotes and Days are numerical fields........why can't I divide one
into the other?

Thanks!

--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...ccess/200612/1
Go to SQL view and add [# of Quotes]/[Days Open] to the GROUP BY list:

GROUP BY [Fiscal Month], ..., [# of Quotes]/[Days Open]

James A. Fortune
CD********@FortuneJames.com

Dec 21 '06 #2
Thanks James. I must still be doing something wrong. Still getting an error
message.
Here is my SQL:

SELECT [Sum for Monthly Chart].[Fiscal Month], Sum([Sum for Monthly Chart].[#
of Quotes]) AS [SumOf# of Quotes], Sum([Sum for Monthly Chart].[Days Open])
AS [Days Open], [# of Quotes]/[Days Open] AS [Avg Days]
FROM [Sum for Monthly Chart]
GROUP BY [Sum for Monthly Chart].[Fiscal Month], [# of Quotes]/[Days Open];
CD********@FortuneJames.com wrote:
>I have a query where I am grouping by Fiscal Month, Summing # of Quotes,
Summing # of Days.......and created an expression.........Avg Days: [# of
[quoted text clipped - 13 lines]
>Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...ccess/200612/1

Go to SQL view and add [# of Quotes]/[Days Open] to the GROUP BY list:

GROUP BY [Fiscal Month], ..., [# of Quotes]/[Days Open]

James A. Fortune
CD********@FortuneJames.com
--
Message posted via http://www.accessmonster.com

Dec 22 '06 #3
Lori2836 via AccessMonster.com wrote:
Thanks James. I must still be doing something wrong. Still getting an error
message.
Here is my SQL:

SELECT [Sum for Monthly Chart].[Fiscal Month], Sum([Sum for Monthly Chart].[#
of Quotes]) AS [SumOf# of Quotes], Sum([Sum for Monthly Chart].[Days Open])
AS [Days Open], [# of Quotes]/[Days Open] AS [Avg Days]
FROM [Sum for Monthly Chart]
GROUP BY [Sum for Monthly Chart].[Fiscal Month], [# of Quotes]/[Days Open];
If you are you trying to divide by [Days Open] rather than the Sum of
[Days Open] try:

SELECT [Fiscal Month], Sum([# of Quotes]) AS [SumOf# of Quotes],
Sum([Days Open]) AS [Sum of Days Open], [# of Quotes]/[Days Open] AS
[Avg Days] FROM [Sum for Monthly Chart] GROUP BY [Fiscal Month], [#
of Quotes]/[Days Open];

If you are trying to divide by Sum of [Days Open] you'll probably be
better off using two queries. Let me know if that is the case and I'll
see what I can come up with.

James A. Fortune
CD********@FortuneJames.com

Dec 22 '06 #4
Got it James........thank you! And have a wonderful holiday!

CD********@FortuneJames.com wrote:
>Thanks James. I must still be doing something wrong. Still getting an error
message.
[quoted text clipped - 5 lines]
>FROM [Sum for Monthly Chart]
GROUP BY [Sum for Monthly Chart].[Fiscal Month], [# of Quotes]/[Days Open];

If you are you trying to divide by [Days Open] rather than the Sum of
[Days Open] try:

SELECT [Fiscal Month], Sum([# of Quotes]) AS [SumOf# of Quotes],
Sum([Days Open]) AS [Sum of Days Open], [# of Quotes]/[Days Open] AS
[Avg Days] FROM [Sum for Monthly Chart] GROUP BY [Fiscal Month], [#
of Quotes]/[Days Open];

If you are trying to divide by Sum of [Days Open] you'll probably be
better off using two queries. Let me know if that is the case and I'll
see what I can come up with.

James A. Fortune
CD********@FortuneJames.com
--
Message posted via http://www.accessmonster.com

Dec 22 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: jc | last post by:
Hi. Just as we have AVG(COLUMN_NAME) and MAX(COLUMN_NAME) how can I write my own variation of a such a function. If I can appreciate how to do this, then I hopefully I can write a...
1
by: sausage31 | last post by:
I have a table as follows.... Device LotID Result1 Result2 Result3 aaa 1 5 10 15 bbb 1 2 4 6 aaa 2 ...
1
by: Najib Abi Fadel | last post by:
Hi i have an ordered table of dates let's say: 1/1/2004 8/1/2004 15/1/2004 29/1/2004 5/2/2004 12/2/2004
1
by: R.A.M. | last post by:
Hello, I am learning SQL Server 2005. I have (correctly) written in .NET assembly DemoSQLServer with aggregate function AvgNoMinMax in class Demo and I have added assembly to database...
5
by: BillCo | last post by:
I just wasted a long time figuring out this and I figure if I post it might save someone some pain! Jet (DAO) will allow you to to use nested aggregate functions like building blocks, e.g.: ...
2
by: Ian825 | last post by:
I need help writing a function for a program that is based upon the various operations of a matrix and I keep getting a "non-aggregate type" error. My guess is that I need to dereference my...
3
by: ncsthbell | last post by:
I am pulling my hair out on this! Seems like it should be easy, I just can not get it to work like I want. I know I am doing something wrong, so I hope someone can be so kind to guide me!!! I...
7
by: kpfunf | last post by:
Getting the following error opening a report, cannot figure out the cause: "You tried to execute a query that does not include the specified expression 'RQ_FuelQuoteReportHistory.Vendor' as part...
8
by: Floortje | last post by:
Hi i have been struggeling with this question for quite some time now. I have some helper classes that handle images (upload an image, create thumbnails and show a imagelist), links (add link,...
4
by: shapper | last post by:
Hello, I have the following Linq query: var q = (from p in database.Posts join pt in database.PostsTags on p.PostID equals pt.PostID join t in database.Tags on pt.TagID equals t.TagID group...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.