I need to perform the below steps to delete the records from multiple tables of the completed one's once they ages out to 18 months after the order changed to completed.
1) Count the number of orders when the status is completed
2) check the condition - count>0
Fetch all the orders which are completed
loop to each orderID
calc TTL based on the completion date(18 months - duration(Todays date - completion date) )
update the TTL to the records of that order
Once TTL updated to the records of completed orders, then they will automatically deleted from DataStax.
Is there a way to perform both DML statements and do some calculations at one place and call that JOB periodically.