how to join more than one sqlite tables
I have 7 Sqlite tables and i want to join all these into one table or say a new table .Every tables has same number of column names.I am getting error ambiguity with column name.How can join all these开发者_开发百科 tables.
To avoid ambiguity, you should prefix the columns with the table names and use column aliases:
create table tab1(id number, value varchar2(20));
create table tab2(id number, value varchar2(20));
create table tab3(id number, value varchar2(20));
insert into tab1(id, value) values(1, 'a');
insert into tab2(id, value) values(1, 'b');
insert into tab3(id, value) values(1, 'c');
create table t4 as
select tab1.id id, tab1.value value1, tab2.value value2, tab3.value value3
from tab1, tab2, tab3
where tab1.id = tab2.id
and tab1.id = tab3.id;
精彩评论