calculation of averages

calculation of averages

 

  

Dear Gurus:
Need some help in doing a calculation.
I have parent-child tables.
I want to figure out the total length of the text_info column for a record.
The master table has one record - and detail info contains the children.
I can have many children using the id, and seq columns.

detail_info (child table) detail_master

id varchar2(30) id
seq number date
text_info varchar2(2000) address.... (other stuff)
date

if I do a -

select sum(vsize(text_info) from detail_info
group by id.

This will give me id sum(vsize) of the records for the id.
001 458 (1 record)
002 88888 (3 records)

I will get the count of the all the records for each id.

Then what I am trying to do is take the sum for each id and do an
average to show the an average number.

I can't seem to do this with an avg(sum(vsize(text_detail)....
Is my use of the group by id causing a problem ? Maybe it's cause
the text_info field is varchar2 ???

How can I accomplish this ?

Thanks.
Steff DeUnger






Oracle LazyDBA home page