Xavier Aguila wrote:

Hi

why this is an error?

sqlite> create table table1( a int, b text, primary key (a));
sqlite> create table table2( c int, d text, primary key (c));
sqlite> CREATE VIEW view1 AS SELECT t1.a, t1.b, t2.c, t2.d FROM table1 as t1, table2 as t2;
sqlite> insert into table1 values(1, "test1");
sqlite> insert into table1 values(2, "test2");
sqlite> insert into table1 values(3, "test3");
sqlite> insert into table2 values(1, "test4");
sqlite> insert into table2 values(2, "test5");
sqlite> insert into table2 values(3, "test6");
sqlite> select * from view1;
1|test1|1|test4
1|test1|2|test5
1|test1|3|test6
2|test2|1|test4
2|test2|2|test5
2|test2|3|test6
3|test3|1|test4
3|test3|2|test5
3|test3|3|test6
sqlite> .header ON
sqlite> select * from view1;
t1.a|t1.b|t2.c|t2.d
1|test1|1|test4
1|test1|2|test5
1|test1|3|test6
2|test2|1|test4
2|test2|2|test5
2|test2|3|test6
3|test3|1|test4
3|test3|2|test5
3|test3|3|test6
sqlite> select a from view1;
SQL error: no such column: a
sqlite> select t1.a from view1;
SQL error: no such column: t1.a


this works fine in version 3.0.8

Regards

Xavier

select "t1.a" from view1; should work. You might wish to use pragma short_column_names = 1 to preserve the previous behavior.

John LeSueur.

Reply via email to