I was actually planning on doing that anyways to test it out. The situation is...that we have a databse that is supposed to empty out at some point but this one is not. It now has 60000 plus records and is slowng down the system considerably. If we can find a script thjat works, I will likely include it as part of a maintenence regiment.
Question I have at this point is how would I write the data portion of the script...in othjer words how do I get it to check the system time and go back 2 weeks. Keep in mind that me getting this far is based on 5 yr old oracle classes so I definately am a bit rusty. > -----Original Message----- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] > Behalf Of Hendrik Schaink > Sent: Tuesday, August 09, 2005 5:56 PM > To: CLUG General > Subject: Re: [clug-talk] (A little OT) Help - SQL Statement > > > Hi Cameron, > > I believe you would want to use another AND clause as in: > > $ship_id=shipmentsid.invoices > DELETE * from invoices WHERE > shipmentsid.shipments=$ship_id AND > shipmentsid.packages=$ship_id AND > shippingdate>two weeks ago > > What this query will do is: retrieve all records with the given shipment > ID AND given package ID AND shippingdate > 2 weeks ago; then delete the > table row(s) for the selected records. > > Watch out: fine-tune your query using a SELECT statement (do not > experiment with DELETE) so you can be sure that the records you retrieve > are those you intend to delete. Also, make sure to leave referential > integrity intact particularly when deleting linked records. > > HTH, > > Hendrik Schaink > > > Cameron wrote: > > Looking to delete information from three databases at the same > time based on > > the date. This is on a foxpro database on a Windows platform. > > > > Databases: > > * invoice.dbf > > * shipments.dbf > > * packages.dbf > > > > I believe the relationship between them is the shipmentsid feild. The > > closest thing I and another tech have come up with is this: > > > > > > $ship_id=shipmentsid.invoices > > DELETE * from invoices WHERE > > shipmentsid.shipments=$ship_id AND > > shipmentsid.packages=$ship_id IF > > shippingdate>two weeks ago > > > > This is where it breaks down: > > Not sure is assigning the variable is necessary and if I have > even done it > > in the right place or if I am missing something. The script > shhould grab > > the date from the system that it is on and delete anything that > is earlier > > than two weeks from the date (i.e. 08-09-2005) > > > > ANy thoughts or ideas would be great! > > > > Cameron > > > > > > > > _______________________________________________ > > clug-talk mailing list > > [email protected] > > http://clug.ca/mailman/listinfo/clug-talk_clug.ca > > Mailing List Guidelines (http://clug.ca/ml_guidelines.php) > > **Please remove these lines when replying > > -- > Hendrik M. Schaink > Chief Consultant > > "Integrated Business Solutions & Dependable Service" > > InfoVision Consulting > Calgary, Alberta, Canada > Phone: (403) 239-0099 > > > "The Vision: We are the partners of choice for companies and > organizations that share our commitment to creating a world > that is truly wise, courageous, prosperous, innovative, > inclusive, sustainable and humane." --Ruben Nelson > > GPG Fingerprint: 1371 0927 8C3C 831F A838 C312 68BC F5DB 010D F3D7 > > _______________________________________________ > clug-talk mailing list > [email protected] > http://clug.ca/mailman/listinfo/clug-talk_clug.ca > Mailing List Guidelines (http://clug.ca/ml_guidelines.php) > **Please remove these lines when replying > _______________________________________________ clug-talk mailing list [email protected] http://clug.ca/mailman/listinfo/clug-talk_clug.ca Mailing List Guidelines (http://clug.ca/ml_guidelines.php) **Please remove these lines when replying

