Hi list,
I found that table aliases are repeated in the headers of compound queries. Is this intentional and/or documented somewhere? I'm asking, because it forces one to either already alias the columns in the query or use the aliased column name in the DataReader (I'm using the .NET provider). Not a big deal but worth asking a question ;-)


C:\Program Files (x86)\SQLite>sqlite3.exe :memory:
SQLite version 3.7.9 2011-11-01 00:52:41
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite> .headers ON
sqlite>
sqlite> CREATE TABLE table1 (c1 INTEGER, c2 TEXT);
sqlite> CREATE TABLE table2 (c3 INTEGER, c4 TEXT);
sqlite>
sqlite> INSERT INTO table1 VALUES (1, 'text1');
sqlite> INSERT INTO table2 VALUES (3, 'text3');
sqlite>
sqlite> SELECT
   ...>   t1.c1,
   ...>   t1.c2
   ...> FROM
   ...>   table1 t1;
c1|c2
1|text1
sqlite>
sqlite> SELECT
   ...>   t1.c1,
   ...>   t1.c2
   ...> FROM
   ...>   table1 t1
   ...>
   ...> UNION
   ...>
   ...> SELECT
   ...>   t2.c3,
   ...>   t2.c4
   ...> FROM
   ...>   table2 t2;
t1.c1|t1.c2
1|text1
3|text3
sqlite>
sqlite> SELECT
   ...>   t1.c1 AS c1,
   ...>   t1.c2 AS c2
   ...> FROM
   ...>   table1 t1
   ...>
   ...> UNION
   ...>
   ...> SELECT
   ...>   t2.c3,
   ...>   t2.c4
   ...> FROM
   ...>   table2 t2;
c1|c2
1|text1
3|text3
sqlite> .e

C:\Program Files (x86)\SQLite>
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to