Please help me with this Query

Database

Please help me with this Query

could anyone help me
whats wrong with this query in teradata

why query is not working though sub query seperately is working perfectly

SELECT * FROM (SELECT 'prod_rplic_test.'|| tablename FROM prod_rplic_test.ETL_VALIDATION_M7_Table_List WHERE counter=1)

Thanks
6 REPLIES

Re: Please help me with this Query

Umm... try this!

SELECT 'prod_rplic_test.'|| tablename FROM prod_rplic_test.ETL_VALIDATION_M7_Table_List WHERE counter=1;

The additional subquery is not required as a SELECT * will simply return everything from your subquery anyway!

Alternativley if you need to add restrictions:

SELECT
*
FROM (
SELECT
'prod_rplic_test.'|| tablename
FROM prod_rplic_test.ETL_VALIDATION_M7_Table_List
WHERE counter=1
) a (colA)
--ADD ADDITIONAL WHERE CONDITIONS/JOINS HERE
;
N/A

Re: Please help me with this Query

I think.......
bcoz u didn't specify alias to the subquery.

Re: Please help me with this Query

[quote]could anyone help me

whats wrong with this query in teradata

why query is not working though sub query seperately is working perfectly

SELECT count(*) FROM
(SELECT 'prod_rplic_test.'|| tablename FROM prod_rplic_test.ETL_VALIDATION_M7_Table_List WHERE counter=1)

My idea behind this is, I have tabulated all database tables in table prod_rplic_test.ETL_VALIDATION_M7_Table_List

now I want to have record count on each table
so first with where counter=1, i am pointing to first table
and next using some loop i can point out next tables

So, if my query above works, that will be really wonderful

Any great gurus Help plzzz

Thanks
Rams

SN
N/A

Re: Please help me with this Query

can you give the error code?

Re: Please help me with this Query

3707 syntax error some')' is missing
but i tried all possible options, still not working

Re: Please help me with this Query

Hi ,

Try this.

SELECT temp.tabname FROM
(SELECT 'prod_rplic_test.'|| tablename as tabname FROM prod_rplic_test.ETL_VALIDATION_M7_Table_List WHERE counter=1) as temp

Regards,
Arun