Show 4 Records that occur more often...and how often they occur.

  • Thread starter Miguel Dias Moura
  • Start date
M

Miguel Dias Moura

Hello,

i have a dataSet in an ASP.Net / VB page which connects to a database named
"DB" with fields AuthorName, BookTitle, BookEditor.

I want do display 4 records in my page as follows:
Author Name # Number of books published by this Author (Number of records
associated with this Author)

I want to display the 4 Authors which published more books...

In conclusion:
I want to show the 4 AuthorName values which appear more often in the
database and display the number of records having that AuthorName.

Can you help me out?

How should my SQL look? What do i need to add?

Thank You,
Miguel
 
A

avnrao

This post should have been in SQL. neway, what required is getting the
things done..

Select Top 4 AuthorName, Sum(BookTitle) from Table Group By AuthorName Order
By Sum(BookTitle) Desc
check if it works.

Av.
 
H

Hans Kesting

avnrao said:
This post should have been in SQL. neway, what required is getting the
things done..

Select Top 4 AuthorName, Sum(BookTitle) from Table Group By AuthorName Order
By Sum(BookTitle) Desc
check if it works.

Av.

shouldn't that be "COUNT(booktitle)" ?? :)


Hans Kesting
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,576
Members
45,054
Latest member
LucyCarper

Latest Threads

Top