?
Solved

Top Number of Record in SQL

Posted on 2003-12-05
15
Medium Priority
?
410 Views
Last Modified: 2010-05-01
Hello All,

Is there anyway to select the (Top 10 Records) based on the CountOfSummaryItem in the following SQL?

s_Sql = "SELECT DAuthor, Count(DAuthor) As CountOfSummaryItem, _
        (Count(*)/(Select count(*) FROM tbl_Records_DR)) as Percentage _
        From tbl_Records_DR GROUP BY DAuthor Order BY DAuthor;"

Thanks guys. ADawn
0
Comment
Question by:ADawn
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 5
  • 3
  • +2
15 Comments
 
LVL 33

Expert Comment

by:hongjun
ID: 9882820
try this

s_Sql = "SELECT TOP 10 DAuthor, Count(DAuthor) As CountOfSummaryItem, _
        (Count(*)/(Select count(*) FROM tbl_Records_DR)) as Percentage _
       From tbl_Records_DR GROUP BY DAuthor Order BY DAuthor;"
0
 
LVL 10

Accepted Solution

by:
ADSaunders earned 240 total points
ID: 9882830
Hi ADawn,
> s_Sql = "SELECT DAuthor, Count(DAuthor) As CountOfSummaryItem, _
>         (Count(*)/(Select count(*) FROM tbl_Records_DR)) as Percentage _
>         From tbl_Records_DR GROUP BY DAuthor Order BY DAuthor;"
s_Sql = "SELECT TOP 10 DAuthor, Count(DAuthor) As CountOfSummaryItem, _
        (Count(*)/(Select count(*) FROM tbl_Records_DR)) as Percentage _
        From tbl_Records_DR GROUP BY DAuthor Order BY CountOfSummaryItem DESC;"


Regards .. Alan
0
 
LVL 33

Expert Comment

by:hongjun
ID: 9882847
The keyword is to use
    TOP 10


hongjun
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 16

Expert Comment

by:Richie_Simonetti
ID: 9882855
hearing...
0
 
LVL 48

Expert Comment

by:Mikal613
ID: 9882894
Richie Simonetti what does that mean?   hearing.... or listening......
0
 
LVL 33

Expert Comment

by:hongjun
ID: 9882907
he meant he is listening to this question to learn something.
he just wish to be subscribed to this question.

Actually to subscribe to this question, one can simply click on the "Subscribe" link.

hongjun
0
 
LVL 16

Expert Comment

by:Richie_Simonetti
ID: 9882919
:)
0
 
LVL 48

Expert Comment

by:Mikal613
ID: 9882938
ohhh thanks.... good to know is that an EE standard of Terminology??
0
 
LVL 16

Expert Comment

by:Richie_Simonetti
ID: 9882950
Sometimes i have no time to post comments, sometimes i would like to know how it ends, sometimes i don't know what to say, sometimes just curious.
0
 
LVL 33

Expert Comment

by:hongjun
ID: 9882951
>> is that an EE standard of Terminology??
Ya that has been a term used and many understand it (at least in EE).
Some other terms are like
listening
hearing
ping
...


hongjun
0
 
LVL 16

Expert Comment

by:Richie_Simonetti
ID: 9882960
you forgot one:
learning...
0
 
LVL 48

Expert Comment

by:Mikal613
ID: 9882973
Thanks guys
0
 
LVL 33

Expert Comment

by:hongjun
ID: 9882994
I know I got to be careful when talking to a veteran expert so I used ... at the end ;)

hongjun
0
 
LVL 16

Expert Comment

by:Richie_Simonetti
ID: 9883421
Hey, i am not too old!!
0
 

Author Comment

by:ADawn
ID: 9888136
Thanks ADSaunders! ADawn
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Suggested Courses

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question