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: Matthias Rogel <rogelREMOVE_at_THISweb.de>
Date: Tue, 21 Jan 2003 09:59:14 +0100
Message-ID: <b0j252$psm14$1@ID-86071.news.dfncis.de>


Mark wrote:

>>This should do it:
>>
>>select min(ID) from (select * from table1 union select * from table2);

>
>
> Thank you.
>
> Additional: how would I identify which table the row is from?
>
> Thanks,
>
> Mark
>
>

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 )
where ID =
select min(ID) from (select * from table1 union select * from table2); Received on Tue Jan 21 2003 - 02:59:14 CST

Original text of this message

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