J
JJEWELL
I have a table named D that contains 707005 records. It was built from an
imported txt file that contained coordinates and concentrations in two
columns with headers lines on each page giving day and group identifications.
The ID field shown in my excerpt below was an autonumber created during the
import.
ID - East1 - North1 - Conc1 - East2 - North2 - Conc2 - Day - Group
===========================================
13631 - null - null - null - null - null - null - 1 - null
13632 - null - null - null - null - null - null - null - ALLST
13643 - 671815.6 - 4062860.7 - 1.11 - 671695.2 - 4062526.5 - 1.53 -null -
null
13644 - 671817.5 - 4062456.2 - 1.32 - 671818.3 - 4062298.7 - 1.40 - null -
null
13645 - 671818.2 - 4062763 - 1.14 - 674132.4 - 4065962.5 - 0.02 - null - null
.....37 more lines with actual data that look the same as the last three
above, then the header rows repeat. After the Day = 1 and Group = ALLST
header rows repeat four times (with 40 records of actual data under the
second and third ones and 21 records under the last one for a total of 141
records of actual data and a grand total of 149 records - actual data plus
header rows), the Group changes to something else, e.g., COP, then after the
13 different Group possibilies are presented (we are at 1937 records at this
point), the Day changes to 2 and the 13 Groups repeat again giving
information for the same 141 coordinates (actual 282, but they are in two
columns). This goes on for 365 days, which give the GRAND TOTAL of 707005
records (149 records per group/day combination and 13 groups and 365 days).
Ultimately, I want to move the second column of coordinates/concentration
data to the bottom of the first column (via union query, append [to table]
queries - whatever - I can figure this out), but the issue at hand is that I
want to fill in the null Day and Group values in each of the records that
contain actual data. I wrote the following query to do this. You'll notice
that this query only returns records with actual data, i.e., the header rows
are removed by on including records where East1 is not null. This should
reduce the number of records to 669045 (141 * 13 * 365). Not sure this
matters, but I thought I would point it out.
SELECT D.ID, D.East1, D.North1, D.Conc1, D.East2, D.North2, D.Conc2, (SELECT
TOP 1 Day FROM D AS Dupe1 WHERE Dupe1.Day Is Not Null AND Dupe1.ID < D.ID
ORDER BY Dupe1.ID DESC) AS DayR, (SELECT TOP 1 Group FROM D AS Dupe2 WHERE
Dupe2.Group Is Not Null AND Dupe2.ID < D.ID ORDER BY Dupe2.ID DESC) AS GroupR
FROM D
WHERE (((D.East1) Is Not Null))
ORDER BY D.ID;
The query works, or appears to, but when I scroll down the query results - I
can get to about record 125 - Access freezes.
Any explanations, solutions, work arounds, etc. are appreciated greatly.
imported txt file that contained coordinates and concentrations in two
columns with headers lines on each page giving day and group identifications.
The ID field shown in my excerpt below was an autonumber created during the
import.
ID - East1 - North1 - Conc1 - East2 - North2 - Conc2 - Day - Group
===========================================
13631 - null - null - null - null - null - null - 1 - null
13632 - null - null - null - null - null - null - null - ALLST
13643 - 671815.6 - 4062860.7 - 1.11 - 671695.2 - 4062526.5 - 1.53 -null -
null
13644 - 671817.5 - 4062456.2 - 1.32 - 671818.3 - 4062298.7 - 1.40 - null -
null
13645 - 671818.2 - 4062763 - 1.14 - 674132.4 - 4065962.5 - 0.02 - null - null
.....37 more lines with actual data that look the same as the last three
above, then the header rows repeat. After the Day = 1 and Group = ALLST
header rows repeat four times (with 40 records of actual data under the
second and third ones and 21 records under the last one for a total of 141
records of actual data and a grand total of 149 records - actual data plus
header rows), the Group changes to something else, e.g., COP, then after the
13 different Group possibilies are presented (we are at 1937 records at this
point), the Day changes to 2 and the 13 Groups repeat again giving
information for the same 141 coordinates (actual 282, but they are in two
columns). This goes on for 365 days, which give the GRAND TOTAL of 707005
records (149 records per group/day combination and 13 groups and 365 days).
Ultimately, I want to move the second column of coordinates/concentration
data to the bottom of the first column (via union query, append [to table]
queries - whatever - I can figure this out), but the issue at hand is that I
want to fill in the null Day and Group values in each of the records that
contain actual data. I wrote the following query to do this. You'll notice
that this query only returns records with actual data, i.e., the header rows
are removed by on including records where East1 is not null. This should
reduce the number of records to 669045 (141 * 13 * 365). Not sure this
matters, but I thought I would point it out.
SELECT D.ID, D.East1, D.North1, D.Conc1, D.East2, D.North2, D.Conc2, (SELECT
TOP 1 Day FROM D AS Dupe1 WHERE Dupe1.Day Is Not Null AND Dupe1.ID < D.ID
ORDER BY Dupe1.ID DESC) AS DayR, (SELECT TOP 1 Group FROM D AS Dupe2 WHERE
Dupe2.Group Is Not Null AND Dupe2.ID < D.ID ORDER BY Dupe2.ID DESC) AS GroupR
FROM D
WHERE (((D.East1) Is Not Null))
ORDER BY D.ID;
The query works, or appears to, but when I scroll down the query results - I
can get to about record 125 - Access freezes.
Any explanations, solutions, work arounds, etc. are appreciated greatly.