T
Tony in Michigan
Please see the below SQL.
I have a field that is stored as two decimal data, which I validate against
zero decimal expected values. The expected value is rounded prior to
summing. To calculate my field value for validation takes me three steps,
plus sorting to remove the invalid, <>0 values, for investigation.
I'd like to combine/reduce/eliminate some of the steps, perhaps go directly
from the source tables, directly to a results output table, without the
interim tables.
Step 1
;;;;; Rounds values to 0 decimal places
UPDATE [RECON ENTRY] SET [RECON ENTRY].round_EV = Round([RECON
ENTRY]![HTS_VALUE],0);
Step 2
;;;;; Sums rounded values makes table to compare against true data
SELECT [RECON ENTRY].ENTRYNUM, Sum([RECON ENTRY].Round_EV) AS SumOfRound_EV
INTO [validation data]
FROM [RECON ENTRY]
GROUP BY [RECON ENTRY].ENTRYNUM;
Step 3
;;;;; Compares calculated values to expected values, makes table of results.
<>0 are invalid, and are reviewed manually.
SELECT [validation data].ENTRYNUM, [validation
data]![SumOfRound_EV]-[AAI_liq 2008]![entered value] AS Expr1 INTO
[validation results]
FROM [validation data] INNER JOIN [AAI_liq 2008] ON [validation
data].ENTRYNUM = [AAI_liq 2008].[entry number]
ORDER BY [validation data]![SumOfRound_EV]-[AAI_liq 2008]![entered value]
DESC;
I have a field that is stored as two decimal data, which I validate against
zero decimal expected values. The expected value is rounded prior to
summing. To calculate my field value for validation takes me three steps,
plus sorting to remove the invalid, <>0 values, for investigation.
I'd like to combine/reduce/eliminate some of the steps, perhaps go directly
from the source tables, directly to a results output table, without the
interim tables.
Step 1
;;;;; Rounds values to 0 decimal places
UPDATE [RECON ENTRY] SET [RECON ENTRY].round_EV = Round([RECON
ENTRY]![HTS_VALUE],0);
Step 2
;;;;; Sums rounded values makes table to compare against true data
SELECT [RECON ENTRY].ENTRYNUM, Sum([RECON ENTRY].Round_EV) AS SumOfRound_EV
INTO [validation data]
FROM [RECON ENTRY]
GROUP BY [RECON ENTRY].ENTRYNUM;
Step 3
;;;;; Compares calculated values to expected values, makes table of results.
<>0 are invalid, and are reviewed manually.
SELECT [validation data].ENTRYNUM, [validation
data]![SumOfRound_EV]-[AAI_liq 2008]![entered value] AS Expr1 INTO
[validation results]
FROM [validation data] INNER JOIN [AAI_liq 2008] ON [validation
data].ENTRYNUM = [AAI_liq 2008].[entry number]
ORDER BY [validation data]![SumOfRound_EV]-[AAI_liq 2008]![entered value]
DESC;