Re: NEWBIE: How do I get the oldest date contained in 3 tables

Поиск
Список
Период
Сортировка
От Lorenzo Thurman
Тема Re: NEWBIE: How do I get the oldest date contained in 3 tables
Дата
Msg-id jldqe4-383.ln1@Hedley.internal.thethurmans.com
обсуждение исходный текст
Ответ на NEWBIE: How do I get the oldest date contained in 3 tables  (Lorenzo Thurman <lorenzo@diespammerhethurmans.com>)
Список 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 по дате отправления:

Предыдущее
От: Sean Davis
Дата:
Сообщение: Versioning
Следующее
От: Lorenzo Thurman
Дата:
Сообщение: Re: NEWBIE: How do I get the oldest date contained in 3 tables