Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Need to count number of occurrances of records in a table

685184Feb 15 2009 — edited Feb 15 2009
I have been tasked with returning data that will count the number of times each record in a particular column exists in the database and return that information to a report for every item that is greater than one. The database is a sample database from a book store. The list I am attempting to create is a list of ISBN numbers that has more than one author. I don't want to return the ISBN number, just the number of authors the book has, which can be garnered by counting the occurances of like ISBN numbers in the table. Any help on this would be appreciated. I have come up with:

select distinct title, (select count(bookauthor.isbn) from bookauthor)
from books, bookauthor
group by title, bookauthor.isbn;

so far, but this returns all the titles and the number 20 for the count statement, which is the total number of ISBN numbers listed in the table.

Thank you
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 15 2009
Added on Feb 15 2009
5 comments
669 views