-- To count the objects before you archive them:
select * from transientBucketSummaries t, pesstoObjects p where p.marshallWorkflowLocation = "inbox" and p.transientBucketId=t.transientBucketId and t.dateAdded < "2016-04-15";
-- and then to archive:
update transientBucketSummaries t, pesstoObjects p set p.marshallWorkflowLocation = "archive" where p.marshallWorkflowLocation = "inbox" and p.transientBucketId=t.transientBucketId and t.dateAdded < "2016-04-16";