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: merging two rows

Re: merging two rows

From: Brian Peasland <dba_at_nospam.peasland.net>
Date: Tue, 26 Sep 2006 21:27:27 GMT
Message-ID: <J67yAD.7H8@igsrsparc2.er.usgs.gov>


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 t1.id = t2.id;

HTH,
Brian

-- 
===================================================================

Brian Peasland
dba_at_nospam.peasland.net
http://www.peasland.net

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
Received on Tue Sep 26 2006 - 16:27:27 CDT

Original text of this message

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