Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: SQL*PLUS question
Try this:
select group_id, avg(rate)
from table a
group by group_id;
17600 Girona (Catalunya)
e-mail: david_at_elpunt.com
dbosc001_at_correu.udg.es
"Y que importa a nadie
cómo está mi alma.
Más triste que el silencio
y más sola que la luna.
Y que importa ser poeta
o ser basura"
Robe (Extremoduro)
>I have one table, table_a which has two attributes group_id and rate. What
I
>want is to retrieve the medium value for each group_id. For example,
> table_a:
> group_id rate
> ------------ ------
> 01 1.0
> 01 1.1
> 01 1.2
> 02 2.1
> 03 3.1
> 03 3.4
> 03 4.0
> 03 4.1
> 03 5.0
>what I want is something like:
> group_id rate
> ------------ ------
> 01 1.1
> 02 2.1
> 03 4.0
>Is there a easy way to do this with sql*plus? Thanks.
>
>Peng Nie
>
>
Received on Wed Mar 17 1999 - 03:58:36 CST