Select Union

From: Randall Skelton <skelton(at)brutus(dot)uwaterloo(dot)ca>
To: pgsql-general(at)postgresql(dot)org
Subject: Select Union
Date: 2004-04-01 15:56:03
Message-ID: 1411C72E-83F5-11D8-A5A5-000393C92230@brutus.uwaterloo.ca
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I have a number of tables with the general structure:

Column | Type | Modifiers
-----------+--------------------------+-----------
timestamp | timestamp with time zone |
value | double precision |
Indexes: tbl__timestamp

and I would like to find the union of the timestamps. Something like:

select timestamp from cal_quat_1 WHERE timestamp BETWEEN '2004-02-01
00:03:30' AND '2004-02-01 00:04:00' UNION select timestamp from
cal_quat_2 WHERE timestamp BETWEEN '2004-02-01 00:03:30' AND
'2004-02-01 00:04:00' UNION select timestamp from cal_quat_4 WHERE
timestamp BETWEEN '2004-02-01 00:03:30' AND '2004-02-01 00:04:00' UNION
select timestamp from cal_quat_4 WHERE timestamp BETWEEN '2004-02-01
00:03:30' AND '2004-02-01 00:04:00' UNION select timestamp from
cal_ccd_temp WHERE timestamp BETWEEN '2004-02-01 00:03:30' AND
'2004-02-01 00:04:00';

Is there a less shorter, less redundant way of writing this?

Cheers,
Randall

Responses

Browse pgsql-general by date

  From Date Subject
Next Message mike 2004-04-01 15:56:38 Problem restoring Database
Previous Message Tom Lane 2004-04-01 15:55:24 Re: A simple question about Read committed isolation level