On Wed, Sep 24, 2014 at 12:48 PM, 麦田观望者 <[email protected]> wrote:
> if we have to tables:
> create table t1(f1 integer,f2 integer);
> create table t2(f1 integer,f2 integer);
>
> the fellowing sql generate a result set with a strange field name:
>
> select t1.f1 from t1
> union
> select t2.f1 from t2
>
> we expect a column named "f1" but we get "t1.f1"
>
> but "select t1.f1 from t1 " get a "f1"
>
If you need a specific output column name, please use the "AS" clause to
specify the name you want.
SELECT t1.f1 AS f1 FROM t1;
SELECT t1.f1 AS f1 FROM t1 UNION SELECT t2.f1 FROM t2;
If you omit the AS clause, SQLite is free to give you any column name it
wants.
>
> is this a bug or by designed?
> _______________________________________________
> sqlite-users mailing list
> [email protected]
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>
>
--
D. Richard Hipp
[email protected]
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users