Wiktor Adamski
<bardzotajneko...@interia.pl> wrote: 
> There's no reason for following error:
> 
> SQLite version 3.6.21
> Enter ".help" for instructions
> Enter SQL statements terminated with a ";"
> sqlite> .headers ON
> sqlite> create table t1(a int);
> sqlite> create table t2(a int);
> sqlite> create table t3(a int);
> sqlite> insert into t1 values(1);
> sqlite> select * from t1 left join t2 using(a) left join t3 using(a);
> a
> 1
> sqlite> select a from t1 left join t2 using(a) left join t3 using(a);
> Error: ambiguous column name: a

You have three distinct columns here - t1.a, t2.a and t3.a. With left joins, 
it's possible for some but not all of them to be null, so it matters which one 
you select.

Even with inner joins, it may matter which column you pick. E.g., in SQLite 
it's possible that a=b but typeof(a) != typeof(b)

Igor Tandetnik

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

Reply via email to