469,964 Members | 1,676 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,964 developers. It's quick & easy.

Jet Vs ADO aggregate function difference


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.:

SELECT
A,
sum(B) as Answer1,
Answer1 * 2 as DoubleAnswer
From
Table
GROUP ON
A;

If you save this query and run it from ADO
(e.g. ADORecordset.Open "qrySavedQuery", myConnection) you will get:

You tried to execute a query that does not include the specified
expression 'Answer1 * 2' as part of an aggregate function.

Yet opening the saved query normally or calling it from DAO will work
fine.

ADO requires you to write the query like this:

SELECT
A,
sum(B) as Answer1,
sum(B) * 2 as DoubleAnswer
From
Table
GROUP ON
A;

i.e. an aggregate function cannot refer to another aggregate function
in the same query.

Anyone else found this, or am I mis-reading cause and effect of problem
here?

Nov 9 '06 #1
0 1390

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by sausage31 | last post: by
2 posts views Thread by Shannan Casteel via AccessMonster.com | last post: by
1 post views Thread by Najib Abi Fadel | last post: by
1 post views Thread by rainxy | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.