By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,998 Members | 2,825 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,998 IT Pros & Developers. It's quick & easy.

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

P: n/a
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
Nov 18 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
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.

"Miguel Dias Moura" <we****@27NOSPAMlamps.com> wrote in message
news:eY**************@tk2msftngp13.phx.gbl...
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

Nov 18 '05 #2

P: n/a
Thanks,

can you tell where can i find the SQL forum?
"avnrao" <av*@newsgroups.com> wrote in message
news:uh**************@TK2MSFTNGP12.phx.gbl...
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.

"Miguel Dias Moura" <we****@27NOSPAMlamps.com> wrote in message
news:eY**************@tk2msftngp13.phx.gbl...
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


Nov 18 '05 #3

P: n/a
microsoft.public.sqlserver.programming

Av.
"Miguel Dias Moura" <we****@27NOSPAMlamps.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
Thanks,

can you tell where can i find the SQL forum?
"avnrao" <av*@newsgroups.com> wrote in message
news:uh**************@TK2MSFTNGP12.phx.gbl...
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.

"Miguel Dias Moura" <we****@27NOSPAMlamps.com> wrote in message
news:eY**************@tk2msftngp13.phx.gbl...
> 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
>
>



Nov 18 '05 #4

P: n/a

"avnrao" <av*@newsgroups.com> wrote in message news:uh**************@TK2MSFTNGP12.phx.gbl...
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
Nov 18 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.