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

Home -> Community -> Usenet -> c.d.o.server -> Re: Join Table

Re: Join Table

From: <mashy_at_null.net>
Date: Fri, 25 Sep 1998 11:21:19 GMT
Message-ID: <6ufubf$mf9$1@nnrp1.dejanews.com>


Hi

Hope I have understood your problem correctly ...

If you want to select the rows of table2 where the tab2_key should be joined on the criteria that the maximum of tab2_key value should be equal to the tab1_key ... Well try this sql , it should work out .

select distinct b.tab2_key
from tab1 a,

       tab2 b
group by a.tab1_key, b.tab2_key
having max(b.tab2_key) = a.tab1_key

Cheers !

Mashya ..
mashy_at_null.net

In article <6ufj5d$557$1_at_imsp009a.netvigator.com>,   paulkcng_at_news.netvigator.com (Ng K C Paul) wrote:
> Is it possible to join two tables based on certain criteria? For example,
>
> tab1_key tab2_key
> -------- --------
> 10 9
> 20 18
> 30 27
> 40 39
> 50 50
>
> Table2 with key smaller or equal to table1.
>
> Can I select the maximun of key of table2 and join with table1?
>
>

-----== Posted via Deja News, The Leader in Internet Discussion ==----- http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum Received on Fri Sep 25 1998 - 06:21:19 CDT

Original text of this message

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