>Christoph Walser <walserc at ee.ethz.ch>
>wrote:
>> I have a table A with a row called 'services' which contains the names
>> of other tables.
>
>I recommend you change your design. You'll have nothing but trouble with 
>this.
>
>Merge all tables into a single table with the extra "service" column.
>

I'm afraid this is not an option. The data needs to be stored in separate 
tables.

>> What I want to do is to query table A and get from it
>> the name of table B which is then accessed.
>> What I tried is the following:
>>
>> SELECT *
>> FROM (
>> SELECT service
>> FROM A
>> WHERE a_key = 1
>> )
>
>No, this is not going to work, nor anything substantially similar. You 
>will have to use "SELECT service FROM A WHERE a_key = 1" in your 
>application to retrieve the table name, then build "select * from 
>tableName" query on the fly.

This is not possible either. The statement has to be executed inside a trigger. 
Another idea came into my mind: what I want to do with the above code is to 
look up a table and get the rowcount of this table. If there were an internal 
table which holds a rowcount for all user tables, my problem would be solved 
without using the above construct. Is there such an internal table which holds 
the rowcount for all user tables?

Christoph Walser

_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to