Re: combine rows dependent on match two columns

From: Michel Cadot <micadot{at}altern{dot}org>
Date: Tue, 10 Mar 2009 17:02:46 +0100
Message-ID: <49b68f25$0$17003$426a34cc_at_news.free.fr>


"NOVA" <nova1427_at_gmail.com> a écrit dans le message de news: 63259416-7767-49eb-a10c-4da91fea9809_at_r29g2000vbp.googlegroups.com... On 10 مارس, 16:50, Shakespeare <what..._at_xs4all.nl> wrote:
> NOVA schreef:
>
>
>
>
>
> > Dear all,
>
> > If I have table like this
>
> > A aa B bb
> > 1 5
> > 2 7
> > 1 7
> > 3 6
>
> > I want to make the result like this
>
> > A or B aa bb
> > 1 5 7
> > 2 7
> > 3 6
>
> > A or B is a column has all data avaliable in both A and B
>
> > help please
>
> I'm sure there are better ways, but how about
>
> select distinct nvl(t1.a,t2.b), t1.aa, t2.bb from example t1, example t2
> where t1.a=t2.b
> or ( t1.a is null and t2.b is not null and not exists (select 1 from
> example t3 where t3.a=t2.b))
> or ( t2.b is null and t1.a is not null and not exists (select 1 from
> example t4 where t1.a=t4.b))
>
> Shakespeare- إخفاء النص المقتبس -
>
> - عرض النص المقتبس -

I know this way

I want better ways

thanks


Post all the ways you know then we can of better ones.

Regards
Michel Received on Tue Mar 10 2009 - 11:02:46 CDT

Original text of this message