[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Top Number of Record in SQL

Posted on 2003-12-05
15
Medium Priority
?
411 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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses

656 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