On 3/27/2012 7:10 PM, Alexey Pechnikov wrote:
Is it possible to permit this behaviour?
CREATE TEMP TABLE user_record (id INTEGER PRIMARY KEY, user_id INTEGER,
name TEXT);
CREATE TEMP VIEW v_user AS SELECT id, name, (SELECT name FROM v_user WHERE
id=r.user_id) as "user" FROM user_record as r;
Error: no such table: v_user
How do you expect this to work? In order to figure out what records
belong to v_user, SQLite needs to already know what records are in v_user.
Are you perhaps looking for something like this:
CREATE TEMP VIEW v_user AS
SELECT r.id as id, r.name as name, r2.name as user
FROM user_record r left join user_record r2 on (r2.id = r.user_id);
--
Igor Tandetnik
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users