J
John G
Hi,
I have a query that returns the following records:
BinID txtRecNumber RSum
1 5 2100
1 52 0
2 148 1200
2 201 769
2 203 0
2 290 1500
45 89 78
45 92 0
45 185 1350
45 243 150
45 251 0
45 257 33
45 287 673
Results should be:
BinID txtRecNumber RSum
2 290 1500
45 257 33
45 287 673
"txtRecNumber" is the Record Number in Ascending Order and "RSum" (running
Sum) is a calculated field. I need to return all the most recent records
which RSum is above the most recent "0".
I have tried the following SQL to return just the records above
the most recent "0" but it returns the Max(txtRecNumber) which of course is
290. I want to return records 290, 257 and 287.
SELECT BinID, TxtRecNumber, RSum
FROM YourQuery
WHERE txtRecNumber >
(SELECT Max(txtRecNumber)
FROM YourQuery
WHERE RSum = 0)
Thanks in advance.
John G
I have a query that returns the following records:
BinID txtRecNumber RSum
1 5 2100
1 52 0
2 148 1200
2 201 769
2 203 0
2 290 1500
45 89 78
45 92 0
45 185 1350
45 243 150
45 251 0
45 257 33
45 287 673
Results should be:
BinID txtRecNumber RSum
2 290 1500
45 257 33
45 287 673
"txtRecNumber" is the Record Number in Ascending Order and "RSum" (running
Sum) is a calculated field. I need to return all the most recent records
which RSum is above the most recent "0".
I have tried the following SQL to return just the records above
the most recent "0" but it returns the Max(txtRecNumber) which of course is
290. I want to return records 290, 257 and 287.
SELECT BinID, TxtRecNumber, RSum
FROM YourQuery
WHERE txtRecNumber >
(SELECT Max(txtRecNumber)
FROM YourQuery
WHERE RSum = 0)
Thanks in advance.
John G