T
Tcs
I have a local table of twelve (12) records. These are utility rates, which include the date they
became effective. Two (2) of these rates (flagged) have been superceded by newer rates. I'm trying
to 'drop' the old rate record so I only have the newer (current) record and thus the correct charge.
Here's the code that produced the output below:
==========
SELECT
tblSanLoc_SCRATCH.Serv,
tblSanLoc_SCRATCH.Class,
tblSanLoc_SCRATCH.[Rate Code],
tblSanLoc_SCRATCH.[Rate Desc],
tblSanLoc_SCRATCH.[Rate Chg],
Max(tblSanLoc_SCRATCH.[Eff Date]) AS [MaxOfEff Date]
FROM
tblSanLoc_SCRATCH
GROUP BY
tblSanLoc_SCRATCH.Serv,
tblSanLoc_SCRATCH.Class,
tblSanLoc_SCRATCH.[Rate Code],
tblSanLoc_SCRATCH.[Rate Desc],
tblSanLoc_SCRATCH.[Rate Chg];
==========
Serv Class Rate Rate Rate MaxOfEff
Code Desc Chg Date
---- ----- ---- -------------------- ---- ----------
GA CH RGA GARBAGE 48 19990101
GA CM C1XW CANS 1 PICKUP PER WK 24 19990101
GA CM C2XW CANS 2 PICKUP PER WK 48 19990101
GA CM C3XW CANS 3 PICKUP PER WK 72 19990101
GA CM C4XW CANS 4 PICKUP PER WK 96 19990101
GA CM C5XW CANS 5 PICKUP PER WK 120 19990101
GA CM CGA GARBAGE 12 19990101
GA CM DUMP DUMPSTER PICKUP CHGS 10 19990101 <-- old
GA CM DUMP DUMPSTER PICKUP CHGS 19 20020801
GA CM RGA GARBAGE 18 20021231
GA RE RGA GARBAGE 15 19990101 <-- old
GA RE RGA GARBAGE 18 20020801
==========
Initially I tried to retrieve my backend data and write directly to my "good" local table (withOUT
the records I don't want). Then I changed to write an intermediate "scratch" table, thinking that I
could easily drop the unwanted records when reading my scratch table and writing my good table.
It seems the ONLY way I can get Access (2k3) to drop the rows that I *don't* want, is to leave off
the "Rate Chg" column. I've tried Max & Last. I've tried moving the "Rate Chg" column to the end,
*after* the date. What am I doing wrong, not doing....WHATEVER? It seems to me that this should be
so SIMPLE, yet it's turning out to be anything BUT. Your assistance wuld be most welcome.
Thanks in advance,
Tom
became effective. Two (2) of these rates (flagged) have been superceded by newer rates. I'm trying
to 'drop' the old rate record so I only have the newer (current) record and thus the correct charge.
Here's the code that produced the output below:
==========
SELECT
tblSanLoc_SCRATCH.Serv,
tblSanLoc_SCRATCH.Class,
tblSanLoc_SCRATCH.[Rate Code],
tblSanLoc_SCRATCH.[Rate Desc],
tblSanLoc_SCRATCH.[Rate Chg],
Max(tblSanLoc_SCRATCH.[Eff Date]) AS [MaxOfEff Date]
FROM
tblSanLoc_SCRATCH
GROUP BY
tblSanLoc_SCRATCH.Serv,
tblSanLoc_SCRATCH.Class,
tblSanLoc_SCRATCH.[Rate Code],
tblSanLoc_SCRATCH.[Rate Desc],
tblSanLoc_SCRATCH.[Rate Chg];
==========
Serv Class Rate Rate Rate MaxOfEff
Code Desc Chg Date
---- ----- ---- -------------------- ---- ----------
GA CH RGA GARBAGE 48 19990101
GA CM C1XW CANS 1 PICKUP PER WK 24 19990101
GA CM C2XW CANS 2 PICKUP PER WK 48 19990101
GA CM C3XW CANS 3 PICKUP PER WK 72 19990101
GA CM C4XW CANS 4 PICKUP PER WK 96 19990101
GA CM C5XW CANS 5 PICKUP PER WK 120 19990101
GA CM CGA GARBAGE 12 19990101
GA CM DUMP DUMPSTER PICKUP CHGS 10 19990101 <-- old
GA CM DUMP DUMPSTER PICKUP CHGS 19 20020801
GA CM RGA GARBAGE 18 20021231
GA RE RGA GARBAGE 15 19990101 <-- old
GA RE RGA GARBAGE 18 20020801
==========
Initially I tried to retrieve my backend data and write directly to my "good" local table (withOUT
the records I don't want). Then I changed to write an intermediate "scratch" table, thinking that I
could easily drop the unwanted records when reading my scratch table and writing my good table.
It seems the ONLY way I can get Access (2k3) to drop the rows that I *don't* want, is to leave off
the "Rate Chg" column. I've tried Max & Last. I've tried moving the "Rate Chg" column to the end,
*after* the date. What am I doing wrong, not doing....WHATEVER? It seems to me that this should be
so SIMPLE, yet it's turning out to be anything BUT. Your assistance wuld be most welcome.
Thanks in advance,
Tom