Oracle FAQ Your Portal to the Oracle Knowledge Grid

Home -> Community -> Usenet -> c.d.o.misc -> Re: merging two rows

Re: merging two rows

From: sunil(nani) <>
Date: 27 Sep 2006 06:10:45 -0700
Message-ID: <>

Brian Peasland wrote:
> sunil(nani) wrote:
> > can i merge two different rows into single row in a situations
> > where i can not use group by clause
> >
> I assume that since you referenced the GROUP BY clause, then you are
> talking about doing this in SQL. But I'm still not sure what you are
> attempting to do here. If you are using SQL, then why not use the GROUP
> BY clause? Do you care to provide a more specific example?
> Otherwise, there are methods to "merge" two rows into a single row in
> the result set. Many aggregate functions (MIN, MAX, etc) do just this
> and you are only required to use the GROUP BY clause when you are
> returning columns that will not participate in the aggregation. You can
> also "merge" two rows by doing a simple JOIN operation:
> SELECT t1.x, t2.x
> FROM table_x t1, tablex t2
> WHERE =;
> HTH,
> Brian
> --
> ===================================================================
> Brian Peasland
> Remove the "nospam." from the email address to email me.
> "I can give it to you cheap, quick, and good.
> Now pick two out of the three" - Unknown

thank you for u r reply
i am using oracle 9i

for example i have two rows in this manner

id name account type code

1    sunil      checking     x            a1
2    sunil      savings       y            a2

can i get in this way by merging two rows

id name account type code account1 type1 code 1

1 sunil checking x a1 savings y a2

i tried to do self join also o think it does not work since there is one primary key called id
and there is no chance of group by also

thank you
sunil Received on Wed Sep 27 2006 - 08:10:45 CDT

Original text of this message