Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 SQL result number.

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2001-02-22 : 23:32:51
Jay writes "Dear Guru,

Before I get told off, I should make it clear that I understand that SQL is a set-based language. This being so, there is no concept of row numbers.

Anyway, my question is :

Is it possible (in standard SQL - ie. no stored proc's), to return a cumaltive count of the records on each row.

ie. If I had a table, of users :

ID  Name
========
1 Jay
2 Mark
4 John


I would like to return the following:

ID  Name   Count
================
1 Jay 1
2 Mark 2
4 John 3


Additionally, I should like to do this for join queries too, so I don't want to add a physical column in the table.

Any ideas, much appreciated.


Jay."
   

- Advertisement -