Stado -> select * from (select t1,t2 from tableA union select '' as t1, '' as t2 from tableB) t order by t1;
+---------------+
| t1 | t2 |
+---------------+
| | |
| text1 | text2 |
+---------------+
2 row(s).
Stado -> select * from (select stime, t1, t2 from tableA union select stime, ''::text as t1, ''::text as t2 from tableB) t order by stime;
+-----------------------------------------+
| stime | t1 | t2 |
+-----------------------------------------+
| 2013-10-16 16:08:30.203 | text1 | text2 |
| 2013-10-16 16:09:05.078 | | |
+-----------------------------------------+
2 row(s).
Stado -> select * from (select t1,t2 from tableA union select '' as t1, '' as t2 from tableB) t order by t1;
+---------------+
| t1 | t2 |
+---------------+
| | |
| text1 | text2 |
+---------------+
2 row(s).
Stado -> select * from (select stime, t1, t2 from tableA union select stime, ''::text as t1, ''::text as t2 from tableB) t order by stime; ------- ------- ------- ------- ------- + ------- ------- ------- ------- ------- + ------- ------- ------- ------- ------- +
+------
| stime | t1 | t2 |
+------
| 2013-10-16 16:08:30.203 | text1 | text2 |
| 2013-10-16 16:09:05.078 | | |
+------
2 row(s).
Now the query is ok to run.