I got the "Using SQLite" book and didn't find the answer there, or in a
Google, DuckDuckGo, or Gigiblast search.
I'm trying to create a field in a table to hold the name of a second
table, then retrieve that name for use.
The code below is the simplest of all the things I've tried. Can anyone
say what should be done so (10.) returns the same as (8.)?
Thanks

1.    sqlite> CREATE TABLE a (id INTEGER PRIMARY KEY, name VARCHAR(16),
anotherTable TEXT);
2.    sqlite> SELECT * FROM sqlite_master;
    table|a|a|2|CREATE TABLE a (id INTEGER PRIMARY KEY, name
VARCHAR(16), anotherTable TEXT)
3.    sqlite> INSERT INTO a (name, anotherTable) VALUES ('table1', 'b');
4.    sqlite> SELECT * FROM a;
    1|table1|b
5.    sqlite> CREATE TABLE b (id INTEGER PRIMARY KEY, name VARCHAR(16),
data FLOAT);
6.    sqlite> INSERT INTO b (name, data) VALUES ('B1', 35.0);
7.    sqlite> INSERT INTO b (name, data) VALUES ('B2', 40.0);
8.    sqlite> SELECT * FROM b;
    1|B1|35.0
    2|B2|40.0
9.    sqlite> SELECT anotherTable FROM a WHERE name='table1';
    b
10.    sqlite> SELECT * FROM (SELECT anotherTable FROM a Where
name='table1');
    b
    sqlite>


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: OpenPGP digital signature
URL: 
<http://mailinglists.sqlite.org/cgi-bin/mailman/private/sqlite-users/attachments/20150224/3389318b/attachment.pgp>

Reply via email to