Re: NEWBIE: How do I get the oldest date contained in 3 tables - Mailing list pgsql-general

From Lorenzo Thurman
Subject Re: NEWBIE: How do I get the oldest date contained in 3 tables
Date
Msg-id jldqe4-383.ln1@Hedley.internal.thethurmans.com
Whole thread Raw
In response to NEWBIE: How do I get the oldest date contained in 3 tables  (Lorenzo Thurman <lorenzo@diespammerhethurmans.com>)
List pgsql-general
Lorenzo Thurman wrote:
> I have three tables using date fields. I want to retrieve the oldest
> date contained in the tables. Can someone show me an example of a query
> that would do that?
> TIA

I think I have it, but if anyone has any comments, I'd appreciate it:

select min(old) as oldest from (select distinct min(create) as old from tab1
UNION
select distinct min(time_now) as old from tab1
UNION
select distinct min(create_time) as old from tab2)

pgsql-general by date:

Previous
From: Sean Davis
Date:
Subject: Versioning
Next
From: Lorenzo Thurman
Date:
Subject: Re: NEWBIE: How do I get the oldest date contained in 3 tables