SQL Question

From: <lsleve_at_my-deja.com>
Date: Thu, 14 Dec 2000 22:09:48 GMT
Message-ID: <91bgf7$h7n$1_at_nnrp1.deja.com>


[Quoted] Considering the following example;

create table mytables (
table_nameschar(20),
reference char(30));
/

insert into mytables values
('TableX','first');
/

insert into mytables values
('TableY', 'second');
/

create tableTableX (
C1 char(20));
/

insert into TableX values
('Oracle Corporation');
/

[Quoted] I need a single query that will extract a tablename from the mytables [Quoted] field and shove it into a select statement with the from table being the result of the query on mytables. I attempted the following to acomplish this:
[Quoted] select C1 from (select table_names from mytables where reference = 'first');

This produced the following output:
select C1 from (selecttable_names from mytables where reference = 'first')
*
ERROR at line1:
ORA-00904: invalid column name

How is this accomplished and what did I do wrong?

LSleve

Sent via Deja.com
http://www.deja.com/ Received on Thu Dec 14 2000 - 23:09:48 CET

Original text of this message