Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6122335
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T15:53:13+00:00 2026-05-23T15:53:13+00:00

I have a table, SCCalls , which has a column Call_CalT_Code . Call_CalT_Code can

  • 0

I have a table, SCCalls, which has a column Call_CalT_Code. Call_CalT_Code can be one of several different values. It also has a column Call_InDate which I will be filtering by.

I need to get 1000 random records (filtered by Call_InDate) in total, distributed equally number for each Call_CalT_Code.

How can I do this?

Edit (gbn): solution has to work on a database that is compatibility mode 80 on SQL Server 2005

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T15:53:13+00:00Added an answer on May 23, 2026 at 3:53 pm

    You may need to play around with the numbers in the division.

    If you have 9 values, then 1000/9 = 111 so you’d only get 999 rows back. So I used 1100 and a later TOP 1000.

    SELECT TOP 1000
       *
    FROM
       (
       SELECT
           *,
           ROW_NUMBER() OVER (PARTITION BY Call_CalT_Code ORDER BY NEWID()) AS rn
        FROM
           MyTable
          ) foo
    WHERE
        rn <= 1100 / (SELECT COUNT(distinct Call_CalT_Code) FROM MyTable)
    ORDER BY
        rn
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have table which has a class data and it has table rows inside
I have table which will only contain information about files, so, as the file
I have table categories (c) and an another table (x) with a column which
I have table TB1 which has the following cols: ID | date --------------------- 1
I have table called FinalForgotten which only contains one field called aname. The field
I have table named as contacts which has nearly 1.2 million records we use
I have table with several fields, one of them is Id auto-increment/primary field. Is
I have table inside a div tab. The table has 40 rows in it
I have table with some fields that the value will be 1 0. This
i have table unser it i have one td with elemets inside the menu

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.