Microsoft
Software
Hardware
Network
Question : Group and Count consecutive numbers in an Access dataset
I have a dataset where I need to count the occurance of consecutive numbers. The challenge is that the same number can show up throughout the dataset, so you can't do a simple group by and count. Each row has a unique row ID that increments by 1.
It is simple to do in Excel with row+1 formulas, but in a database it has been tuff. I have been able to get close by joining the table to itself on the Unique ID +/- 1 to get the previous and next day values in one record, however that does not solve my objective of getting a count of consecutive values when the same value can show up more than once in separate places.
Here is a subset of the data:
ID COBDate Name Value
821902 11/27/06 Series1 7.008571667
821903 11/28/06 Series1 7.008571667
821904 11/29/06 Series1 7.008571667
821905 11/30/06 Series1 7.007347143
821906 12/01/06 Series1 7.008571667
821907 12/04/06 Series1 7.008571667
821908 12/05/06 Series1 7.008571667
should result in:
Count 1: 7.008571667 = 3
Count 2: 7.007347143 = 1
Count 3: 7.008571667 = 3
Also attached is an excel file to import to Access for testing.
Answer : Group and Count consecutive numbers in an Access dataset
Rereading, my WHERE clause is mixed up. Replace this line:
Where B.Value<>A.Value And B.ID
(°v°)
Random Solutions
Problems with parsing an error message into a label on a form
"You cancelled the previous operation error" MS ACCESS
RDP in Adminpak.msi for Windows Server 2003/XP: How to turn off the connect local resource option
extract numbers from a cell
SSIS Package Called from a SQL Job does not report error
Truncate text to n character of a string
Export to Excel Grouping
How to enter the Product Key in MS Exchange 2010
sql server add valid owner
Proper syntax?