Results 1 to 4 of 4
  1. #1
    Join Date
    Dec 2005
    Posts
    121

    Unanswered: Looking for a "Top 100"

    What code could you use to build a query to pull out the top 100 summed records (example, you have 1000 stores with multiple records in the table, you build a query that groups by store number, then totals a column. I need it to only show the top 100 out of the 1000 based on the highest numbers in that criteria column. Any quick suggestions?

  2. #2
    Join Date
    Feb 2004
    Location
    Chicago, IL
    Posts
    1,312
    How about using the TOP command in SQL? If you are in the query designer, there is a combo box with the word All in it. You can select 100 from the list. Or if you are looking at the SQL put in:

    SELECT TOP 100 ...

    The one problem is it will select the top 100 unique values. So if you are counting orders at a store and there are 10 stores with 23 orders you might end up with 109 records. You might have to add another field for it to decide which of the 10 stores to include and which to exclude.

  3. #3
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    Yup - use "TOP 100". Srsly - check it out in help. The answer is in the thread title
    Testimonial:
    pootle flump
    ur codings are working excelent.

  4. #4
    Join Date
    Dec 2005
    Posts
    121
    You're never too old to learn something new. I didn't realize it was like a snake in the grass right in front of me, thanks for the heads up!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •