Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Show 4 Records that occur more often...and how often they occur.

Reply
Thread Tools

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

 
 
Miguel Dias Moura
Guest
Posts: n/a
 
      05-06-2004
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


 
Reply With Quote
 
 
 
 
avnrao
Guest
Posts: n/a
 
      05-06-2004
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" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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
>
>



 
Reply With Quote
 
 
 
 
Miguel Dias Moura
Guest
Posts: n/a
 
      05-06-2004
Thanks,

can you tell where can i find the SQL forum?


"avnrao" <(E-Mail Removed)> wrote in message
news:uh1$(E-Mail Removed)...
> 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" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > 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
> >
> >

>
>



 
Reply With Quote
 
avnrao
Guest
Posts: n/a
 
      05-06-2004
microsoft.public.sqlserver.programming

Av.
"Miguel Dias Moura" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
> Thanks,
>
> can you tell where can i find the SQL forum?
>
>
> "avnrao" <(E-Mail Removed)> wrote in message
> news:uh1$(E-Mail Removed)...
>> 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" <(E-Mail Removed)> wrote in message
>> news:(E-Mail Removed)...
>> > 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
>> >
>> >

>>
>>

>
>



 
Reply With Quote
 
Hans Kesting
Guest
Posts: n/a
 
      05-06-2004

"avnrao" <(E-Mail Removed)> wrote in message news:uh1$(E-Mail Removed)...
> 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


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Find pairs that occur in two or more sets Markus Dehmann C++ 6 02-12-2005 04:04 PM
MCSE exam # 70-216. They they show you the score?? Jack Black Microsoft Certification 1 12-09-2004 11:54 PM
Reporting important unhandled exceptions before they occur Afanasiy Python 3 11-04-2003 06:35 PM
they turn, they power, they make nice pics Keith and Jenn Z. Digital Photography 0 09-21-2003 04:16 AM
Catching exceptions in JSP when they occur in Servlets Mick Java 0 08-06-2003 01:12 PM



Advertisments