Hello everyone, I think I've found a bug in various versions of SQLite including the latest release (3.6.16) relating to column names when using UNION.
Steps to reproduce: sqlite> CREATE TABLE `tab` (`val` TEXT); sqlite> INSERT INTO `tab` (`val`) VALUES ('a'); sqlite> .headers ON sqlite> .mode column sqlite> SELECT `val` FROM `tab`; val ---------- a sqlite> SELECT `tab`.`val` FROM `tab` UNION SELECT 'b'; `tab`.`val` ----------- a b As you can see, the column header is "val" as expected in the first select, but when a union is introduced, the column header becomes the literal string specified in the select left of the UNION, "`tab`.`val`". Additionally, a workaround is to specify the resultant column name using AS: sqlite> SELECT `tab`.`val` AS `val` FROM `tab` UNION SELECT 'b'; val ---------- a b -- Nathaniel Ekoniak nathan...@ekoniak.net _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users