Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Teradata SQL and Nested Functions

Status
Not open for further replies.

jakeH

Programmer
Jun 25, 2002
7
GB
My company has just upgraded to v2r5 and a user has hit a snag with a query they're running which has the following line of sql

count(sum(PRD_BO_CCM_VIEWS.ROCK_EVT_AGNT_ACTVY.DGT_DIAL))

Teradata flags this as an error as it logically cannot nest aggregate functions.

However, if Teradata could run this, would the result always be 1? Is this correct?
 
This has nothing to do with your upgrade, every Teradata version returns that error message.

You have to use Derived Tables:
select
count(*)
from
(select
sum(PRD_BO_CCM_VIEWS.ROCK_EVT_AGNT_ACTVY.DGT_DIAL) as x
from table
) dt


"However, if Teradata could run this, would the result always be 1? Is this correct?"

Who knows?
This might be:
select
count(sum(PRD_BO_CCM_VIEWS.ROCK_EVT_AGNT_ACTVY.DGT_DIAL))
from table
group by columnx

Btw, does any other DBMS return a result?

Dieter
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top