Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: MIN value from a column in 2 tables.

Re: MIN value from a column in 2 tables.

From: Mark <mark.harris.spam.begone_at_ukonline.co.uk.spam.begone>
Date: Tue, 21 Jan 2003 14:59:41 -0000
Message-ID: <3e2d605e$0$2572$afc38c87@news.easynet.co.uk>


> I would rather do it like this:
>
> SELECT
> *
> FROM (
> SELECT
> *
> FROM
> ( select min(ID) as ID, 'table1' as this_table from table1
> union all
> select min(ID) as ID, 'table2' as this_table from table2 )
> ORDER BY id DESC
> )
> WHERE rownum = 1
>
> This way, tables 1 and 2 are only hit once.

Thank you - excellent! Received on Tue Jan 21 2003 - 08:59:41 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US