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: 64140
Registered: March 2007
Location: Nanterre, France, http://...
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: Fri Dec 09 07:34:48 CST 2016

Total time taken to generate the page: 0.08774 seconds