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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

select in teradat

Status
Not open for further replies.

kartdb

Programmer
Jul 29, 2002
6
0
0
US
I have a query wich goes some thing like this...

select a.dept,a.emp from ((select Distinct 1,2,3 from (select 1,2,3,4,5 from dept) as a) as b;

1,2,3,4,5 are columns...

When I run this query,it is giving me the error,table/view/procedure a does not exits...

I there any wrong in my query or Is there any other approach...

I would appreciate some one's help..


Thank you....
 
When you are using derived tables you should give the columns a name.

Something like this (the exact solution is impossible to give to you: I have not enough data to know which column means what).

But I should look like this anyway:

select b.dept,b.emp from (select Distinct 1,2,3 from (select 1,2,3,4,5 from dept) as a(dept,emp,x,y,z)) as b(dept,emp,z)

 
select a.dept,a.emp from ((select Distinct 1,2,3 from (select 1,2,3,4,5 from dept) as a) as b;

In the above query, derived table "a" is visible to only "b" not to the main level. So, your query should look like

select b.dept, <<---
b.emp <<---
from ((select Distinct 1,2,3 from (select 1,2,3,4,5 from dept) as a) as b;
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top