Query - Remove old entries

Number11

Member
Local time
Today, 02:34
Joined
Jan 29, 2020
Messages
623
So we have a table that gets updated every day with the last events. like a log on the processing of any order

The field that gets updated is called [Order_Status] and the date gets updated within the [ImportingDate] - what i need to do is once completed delete (or archive) all earlier records so just leaves the "Completed" entry - how can this ne done from a query please

ORDER_NoOrderStatusImportingDate
148774Completed
26/01/2022​
148774Picking
24/01/2022​
148774Assigned
23/01/2022​
 
Suggest tou add autonumber field.
As much as possible to all tables.
There must be a better way than this:

Delete * from Table1
Where (Select Count("1") From Table1 As T Where T.Order_No = Table1.Order_No And OrderStatus="Complete")<>0
And ID <> (Select ID From Table1 As Y Where Y.Order_No = Table1.Order_No And OrderStatus = "Complete")
 
I would leave the records and just apply filter. Never know, someday knowing when an order was in 'picking' status may be requested.
 
I would leave the records and just apply filter. Never know, someday knowing when an order was in 'picking' status may be requested.
Yeah i think you are correct will create a query with Max just to show last entry Thanks always :)
 

Users who are viewing this thread

Back
Top Bottom