Re: How to obtain the maximum value of a date, between 3 tables... - Mailing list pgsql-general

From Vincent Veyron
Subject Re: How to obtain the maximum value of a date, between 3 tables...
Date
Msg-id 1291863529.2571.3.camel@asus-1001PX.home
Whole thread Raw
In response to Re: How to obtain the maximum value of a date, between 3 tables...  (Andre Lopes <lopes80andre@gmail.com>)
Responses Re: How to obtain the maximum value of a date, between 3 tables...  (Vincent Veyron <vv.lists@wanadoo.fr>)
List pgsql-general
Le mercredi 08 décembre 2010 à 13:35 +0000, Andre Lopes a écrit :
> Hi,
>
> Thanks for the reply.
>
> And there are other options to do it without using a UNION? I don't
> need to know from witch table comes the greatest date, but the query
> is complex, this query is part of an UNION. The use of the CASE WHEN
> could be an alternative?
>


 SELECT 'tbl1',last_refresh_date FROM tbl1 UNION SELECT 'tbl2',
last_refresh_date FROM tbl2 UNION SELECT 'tbl3', last_refresh_date FROM
tbl3 ORDER BY 1 DESC;



--
Vincent Veyron
http://marica.fr/
Progiciel de gestion des dossiers de contentieux et d'assurance pour le service juridique


pgsql-general by date:

Previous
From: Toby Corkindale
Date:
Subject: Re: pl/perl interpreter instance(s) - how long does it persist?
Next
From: Fujii Masao
Date:
Subject: Re: Postgresql 9.1 pg_last_xact_replay_timestamp limitations