Home » SQL & PL/SQL » SQL & PL/SQL » It is possible?
It is possible? [message #241713] Wed, 30 May 2007 08:20 Go to next message
dspegas
Messages: 1
Registered: May 2007
Location: Brasil
Junior Member
Select avg(count(*)) from books
group by book_id

????
Re: It is possible? [message #241717 is a reply to message #241713] Wed, 30 May 2007 08:33 Go to previous messageGo to next message
kdipankar
Messages: 9
Registered: December 2006
Junior Member
Try out this
   select avg(x.cnt) from (select count(1) cnt from books group by book_id) x
Re: It is possible? [message #241720 is a reply to message #241713] Wed, 30 May 2007 08:35 Go to previous messageGo to next message
mbalves
Messages: 20
Registered: May 2007
Junior Member
..or try out this

Select avg(c1) from (select book_id, count(*) c1 from books group by book_id)
Re: It is possible? [message #241722 is a reply to message #241713] Wed, 30 May 2007 08:42 Go to previous message
Michel Cadot
Messages: 68718
Registered: March 2007
Location: Saint-Maur, France, https...
Senior Member
Account Moderator
Yes this is possible.
SQL> select avg(count(*)) from emp group by deptno;
AVG(COUNT(*))
-------------
   4.66666667

1 row selected.

Regards
Michel
Previous Topic: Trigger problem
Next Topic: table design question: storing both character data and numeric data in a VARCHAR2(10)
Goto Forum:
  


Current Time: Wed Dec 04 18:55:42 CST 2024