> select tickettab.tokenid, ticketmultab.techcode,ticketmultab.techcode,
> tickettab.problemstmt,ticketmultab.problemstmt
> from (tickettab LEFT JOIN ticketmultab ON tickettab.tokenid=ticketmultab.tokenid)
> as ticketjoinedtab order by
> ticketjoinedtab.arrivaldate desc,
> ticketjoinedtab.arrivaltime desc
Oh, I see, joining is of course false, my fault. must be like this, i
think:
select <fields> from tablea union select <the same fields> from tableb
order by <field>
I tried it with two sample tables on 7.1.3 and it worked:
bert=> select version(); version
-------------------------------------------------------------PostgreSQL 7.1.3 on i686-pc-linux-gnu, compiled by GCC
2.96
(1 row)
bert=> \d ta Table "ta"Attribute | Type | Modifier
-----------+---------+-----------------------------------------------id | integer | not null default
nextval('"ta_id_seq"'::text)data | text | i | integer |
Index: ta_id_key
bert=> \d tb Table "tb"Attribute | Type | Modifier
-----------+---------+------------------------------------id | integer | default nextval('ta_id_seq'::text)data
| text | i | integer |
bert=> select * from ta;id | data | i
----+------+--- 1 | qwe | 1 2 | ert | 3 3 | tzu | 5
(3 rows)
bert=> select * from tb;id | data | i
----+------+--- 4 | wer | 2 5 | rtz | 4 6 | zui | 6
(3 rows)
bert=> select * from ta union select * from tb order by i;id | data | i
----+------+--- 1 | qwe | 1 4 | wer | 2 2 | ert | 3 5 | rtz | 4 3 | tzu | 5 6 | zui | 6
(6 rows)
Markus Bertheau