Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Getting single (first) value from many side of a 1-to-many join??
I'm not sure what you mean by first. It only really becomes useful after
a sort. If you're after the lowest value then you could use the MIN
aggregation function.
e.g.
select a.id,min(value)
from a,b
where a.id = b.id
group by a;
Greg Schetinin wrote:
> Help!!
>
> I need a Select that will let me join 2 tables in a one to many
> relationship but I only want my result to contain a single 'record'
> with the first value from the many side.
>
> ex. Table1 Table2
> id id , value
>
> data 1 1,a
> 1,b
> 1,c
> 2 2,d
> 2,e
>
> Joining by id I'm getting:
>
> 1,1,a
> 1,1,b
> 1,1,c
> 2,2,d
> 2,2,e
>
> I want:
> 1,1,a
> 2,2,d
>
> There are no values in Table2 to identify the correct record to use.
>
> I've searched and can't find a solution. Any ideas?
>
> Thanks in advance for any help!
Received on Tue Mar 30 1999 - 02:51:43 CST
![]() |
![]() |