Matt,
You cannot select a column from a relation if the relation does not include
the column. The query inside the ( ) returns a single column, table_id.

select a_format
from
(
select table_id
from table_id_list
where prefix_code = 'MyPrefix_code'
);

However, if table_id corresponds to a_format, you can supply an alias for
that column in the inner select, like this:

select a_format
from
(
select table_id as a_format
from table_id_list
where prefix_code = 'MyPrefix_code'
);


Regards
Tim Romano
Swarthmore PA











On Sun, May 2, 2010 at 10:22 AM, Matt Young <youngsan...@gmail.com> wrote:

> I am a bit of a novice.  I am dealing with meta data, descriptions of
> the Bureau of Labor Statistics database. BLS data is identified by a
> series code (16 chars long) but the series format is different for
> each data group)
>
> I need to extract from an SQL table the names of other SQL tables and
> reference them in a second query to build the proper series_id code:
>
> I haven't tried this, I assume it can't be done:
>
> select a_format  from (select table_id from table_id_list where
> prefix_code = 'MyPrefix_code');
>
> Is this beyond SQL?  Is there a better solution?
> _______________________________________________
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to