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

  • SEARCH
  • Home
  • 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 73131
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T20:09:12+00:00 2026-05-10T20:09:12+00:00

Suppose I have a SELECT statement that returns some set of results. Is there

  • 0

Suppose I have a SELECT statement that returns some set of results. Is there some way I can number my results in the following way:

SELECT TOP 3 Name FROM PuppyNames ORDER BY NumberOfVotes

would give me…

Fido

Rover

Freddy Krueger

…but I want…

1, Fido

2, Rover

3, Freddy Krueger

where of course the commas signify that the numbers are in their own column. [I am using SQL Server 2000.]

  • 1 1 Answer
  • 1 View
  • 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. 2026-05-10T20:09:12+00:00Added an answer on May 10, 2026 at 8:09 pm

    In Microsoft SQL Server 2005, you have the ROW_NUMBER() function which does exactly what you want.

    If you are stuck with SQL Server 2000, the typical technique was to create a new temporary table to contain the result of your query, plus add an IDENTITY column and generate incremental values. See an article that talks about this technique here: http://www.databasejournal.com/features/mssql/article.php/3572301/RowNumber-function-in-SQL-Server-2005.htm

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Suppose I have the following query: select * from A, B, C, D where
Suppose I have a datetime column in MySQL. How do I select all that
Suppose i have 1kk records in my database. Now i need to select some
Suppose that I have the following code: private void UpdateDB(QuoteDataSet dataSet, Strint tableName) {
I have a PDO statement that for some reason refuses to execute properly. It
Suppose that I have a table with the following schema: tableId field1 field2 .....
suppose I have SELECT * FROM table t GROUP BY j HAVING condition_one OR
Suppose I have a dropdown (select tag) with 3 values. Our first option has
suppose i have a .on() function wherein i select multiple ids $(#i, #am, #your,
Suppose I have this: <select id=myselect> <option rel=a>1</option> <option rel=b>2</option> <select> How do I

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.