[AccessD] SQL Gurus - Running count.

Max Wanadoo max.wanadoo at gmail.com
Mon Jun 8 15:33:13 CDT 2009


Thanks Jim,

I "stumbled" across the answer for the second one.

I will try the first.

Cheers

Max



-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Jim Dettman
Sent: 08 June 2009 20:35
To: 'Access Developers discussion and problem solving'
Subject: Re: [AccessD] SQL Gurus - Running count.


  You need to have a unique key:

SELECT
 (SELECT Count(ID) FROM myTable t2 WHERE t2.ID < t1.ID)+1 AS RowNum,
 *
FROM myTable t1
ORDER BY t1.ID

 As for the second, just define a column as:

 Row:1

Jim.

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Max Wanadoo
Sent: Monday, June 08, 2009 3:09 PM
To: 'Access Developers discussion and problem solving'
Subject: Re: [AccessD] SQL Gurus - Running count.

Any takers please?

Max



-----Original Message-----
From: Max Wanadoo [mailto:max.wanadoo at gmail.com] 
Sent: 08 June 2009 19:14
To: 'Access Developers discussion and problem solving'
Subject: SQL Gurus - Running count.

Hi Guys,

With a select statement, how do I get a running count matching the rows
return.
Starting at 1 and incrementing by 1 for each row.
The final count to be equal to the number of rows returned.
The count to be part of the query.

I also want a second Count but this time not incremented.  Just a 1 in a
column for each row returned.

Thanks

Max



-- 
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com

-- 
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com




More information about the AccessD mailing list