Subject | Nested aggregate functions |
---|---|
Author | Rick Debay |
Post date | 2007-02-21T17:28:10Z |
I think the test for nested aggregate functions is incorrect.
The following statement is allowed:
SELECT
SUM(t1.COL1 - (SELECT t2.COL1 FROM TABLE2 t2 WHERE t2.COL2 = ?))
FROM
TABLE1 t1
This statement is not (returns 'Nested aggregate functions are not
allowed'):
SELECT
SUM(t1.COL1 - (SELECT SUM(t2.COL1) FROM TABLE2 t2 WHERE t2.COL2 = ?))
FROM
TABLE1 t1
In both cases the SELECT on TABLE2 is standalone, and does not require
any nested aggregation on the original stream.
Disclaimer: This message (including attachments) is confidential and may be privileged. If you have received it by mistake please notify the sender by return e-mail and delete this message from your system. Any unauthorized use or dissemination of this message in whole or in part is strictly prohibited. Please note that e-mails are susceptible to change. RxStrategies, Inc. shall not be liable for the improper or incomplete transmission of the information contained in this communication or for any delay in its receipt or damage to your system. RxStrategies, Inc. does not guarantee that the integrity of this communication has been maintained nor that this communication is free from viruses, interceptions or interference.
The following statement is allowed:
SELECT
SUM(t1.COL1 - (SELECT t2.COL1 FROM TABLE2 t2 WHERE t2.COL2 = ?))
FROM
TABLE1 t1
This statement is not (returns 'Nested aggregate functions are not
allowed'):
SELECT
SUM(t1.COL1 - (SELECT SUM(t2.COL1) FROM TABLE2 t2 WHERE t2.COL2 = ?))
FROM
TABLE1 t1
In both cases the SELECT on TABLE2 is standalone, and does not require
any nested aggregation on the original stream.
Disclaimer: This message (including attachments) is confidential and may be privileged. If you have received it by mistake please notify the sender by return e-mail and delete this message from your system. Any unauthorized use or dissemination of this message in whole or in part is strictly prohibited. Please note that e-mails are susceptible to change. RxStrategies, Inc. shall not be liable for the improper or incomplete transmission of the information contained in this communication or for any delay in its receipt or damage to your system. RxStrategies, Inc. does not guarantee that the integrity of this communication has been maintained nor that this communication is free from viruses, interceptions or interference.