Archive a range of date

G

Guest

I have a date range that I would like to archive with in the database. I
currently run the select query, print the data range and then go to the
table and highlight the data in the table to be deleted . How is it possible
to create a query to move the requested data range creating an archive table
but be able to pull up the data at a latter time with out have a query
search a whole table to find it?
This is the query I use to locate the need data.
SELECT OverTimebyEmp1.Expr2, OverTimebyEmp1.oTDLdaTE, OverTimebyEmp1.oTDLOP,
OverTimebyEmp1.OverTimebyEmp01.oTDLhOURUSED,
OverTimebyEmp1.OVETTIMEUSEDOWN.oTDLhOURUSED, OverTimebyEmp1.oVERtIMErEFUSED,
OverTimebyEmp1.oTBlocked, OverTimebyEmp1.OverTimebyEmp01.HrOffered,
OverTimebyEmp1.OVETTIMEUSEDOWN.HrOffered, OverTimebyEmp1.Whyexcused,
Employees.SSI, OverTimebyEmp1.AuthorizationName, OverTimebyEmp1.Expr4,
OverTimebyEmp1.Expr3
FROM OverTimebyEmp1 INNER JOIN Employees ON OverTimebyEmp1.SSI = Employees.SSI
GROUP BY OverTimebyEmp1.Expr2, OverTimebyEmp1.oTDLdaTE,
OverTimebyEmp1.oTDLOP, OverTimebyEmp1.OverTimebyEmp01.oTDLhOURUSED,
OverTimebyEmp1.OVETTIMEUSEDOWN.oTDLhOURUSED, OverTimebyEmp1.oVERtIMErEFUSED,
OverTimebyEmp1.oTBlocked, OverTimebyEmp1.OverTimebyEmp01.HrOffered,
OverTimebyEmp1.OVETTIMEUSEDOWN.HrOffered, OverTimebyEmp1.Whyexcused,
Employees.SSI, OverTimebyEmp1.AuthorizationName, OverTimebyEmp1.Expr4,
OverTimebyEmp1.Expr3
ORDER BY OverTimebyEmp1.Expr2, OverTimebyEmp1.oTDLdaTE;
 
A

Allen Browne

See:
Archive: Move records to another table
at:
http://allenbrowne.com/ser-37.html

The article explains how to avoid the whole issue by flagging the records as
old/obsolete/inactive/whatever, instead of having to move them at all. It's
then dead-easy to include/exclude the old records as needed.

But if you want to move them, it also explains how to execute an Append
query statement that puts them in the archive, followed by a Delete query
statement that removes them from the main table.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top