Solved

Top Number of Record in SQL

Posted on 2003-12-05
15
395 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
  • 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 60 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
 
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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
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

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

708 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now