0
votes

I have a condition where I need to check number of rows returned by select query in Teradata.

My query looks like below

select 
PDate ,Risk ,BName ,BNumber ,
ONumber ,OnNumber ,ID_CD ,Entity ,
AU ,RType, count (*) 
from Load_one.import_test
group by 1,2,3,4,5,6,7,8,9,10
having count (*) > 1;

So I would like to know the count of rows it returns. I tried something like below

Select Count(*)
From    ( select 
PDate ,Risk ,BName ,BNumber ,
ONumber ,OnNumber ,ID_CD ,Entity ,
AU ,RType, count (*) 
from Load_one.import_test
group by 1,2,3,4,5,6,7,8,9,10
having count (*) > 1;
)  as temp

It returning an error: select failed 3707 expected something like an 'EXCEPT' keyword or an 'UNION' keyword or a 'MINUS' keyword between an integer and ;

Please help me.

Just remove the semicolon after having count(*) > 1, that is all. - Tim Biegeleisen
Why do you nee the count as a seperate request? The very first information returned by Teradata is the number of rows in the result set (Teradata starts retunrning the 1st row of an answer set after it's fully created). - dnoeth
I would like to use the count returned by the query inside to start a job. @dnoeth - Sam