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

Home -> Community -> Usenet -> c.d.o.tools -> Re: SQL to bunch rows together?

Re: SQL to bunch rows together?

From: wysza <awysza_at_yahoo.com>
Date: Sat, 03 Feb 2001 13:12:19 GMT
Message-ID: <TsTe6.4613$5H.665120@typhoon2.ba-dsg.net>

select min(column_a), column_b, sum(column_c) from my_table group by column_b;

column_a column_b column_c
-------- -------- --------

    1          abc         190
    2          cdf         78

Of course it selects two columns (b & c) as you needed and gives you minimum from coulmn_a.
Later you can do sth about column_a.

hth
wysza

"Billy Collins" <billy_collins_at_my-deja.com> wrote in message news:95g0cf$akb$1_at_nnrp1.deja.com...
> Due to new data designs, I need to bunch some rows in my table!
>
> My table currently looks like this:
>
> column_a column_b column_c
> -------- -------- --------
> 1 abc 90
> 2 cdf 78
> 3 abc 100
>
>
> Now the problem is that I have to go through the table and bunch all
> the data with the same value in column b. So my new table would look
> like:
>
> column_a column_b column_c
> -------- -------- --------
> 1 abc 190
> 2 cdf 78
>
>
> How to handle this situation? About the column_a, well it is just an
> auto incremented internal ID and it can be managed with another
> sequence. But I need some help with SQL to bunch the rows with the same
> value in the column b! I dont mind having to create a temp table if
> needed.
>
> I would appreciate any pointers/advice.
>
> Thanks!
>
>
> Sent via Deja.com
> http://www.deja.com/
Received on Sat Feb 03 2001 - 07:12:19 CST

Original text of this message

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