SELECT min(x) FROM
(
SELECT min(datecol1) AS x FROM table1
UNION ALL
SELECT min(datecol2) AS x FROM table2
UNION ALL
SELECT min(datecol3) AS x FROM table3
) ss;
Exercise for newbie: which of the AS clauses are redundant?
Um, all of them?
Yah, but only if you do this:
SELECT min(*) FROM
(
Tom Lane wrote:
"Dann Corbit" <[EMAIL PROTECTED]> writes:
[EMAIL PROTECTED] On Behalf Of Lorenzo Thurman
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?
Just do a union and return
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 (se
Brent Wood wrote:
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?
You could write a custom function doing the same sort of thing, or
(perhaps more portable) u
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?
You could write a custom function doing the same sort of thing, or
(perhaps more portable) use generic sqls & v
On 4/9/07, Tom Lane <[EMAIL PROTECTED]> wrote:
"Dann Corbit" <[EMAIL PROTECTED]> writes:
>> [EMAIL PROTECTED] On Behalf Of Lorenzo Thurman
>> 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 wou
"Dann Corbit" <[EMAIL PROTECTED]> writes:
>> [EMAIL PROTECTED] On Behalf Of Lorenzo Thurman
>> 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?
> Just do a union and return the min
Just do a union and return the min
> -Original Message-
> From: [EMAIL PROTECTED] [mailto:pgsql-general-
> [EMAIL PROTECTED] On Behalf Of Lorenzo Thurman
> Sent: Monday, April 09, 2007 7:32 AM
> To: pgsql-general@postgresql.org
> Subject: [GENERAL] NEWBIE: How do I g
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
---(end of broadcast)---
TIP 6: explain analyze is your friend