Delete requests

Delete requests

If you would like to delete the older requests, you could use the below query.

For MSSQL:

delete from workorder where dateadd(s,datediff(s,GETUTCDATE() ,getdate()) + (CREATEDTIME/1000),'1970-01-01 00:00:00') <= convert(varchar,'2010-04-01 00:00',21)

Postgres/Mysql :

delete from workorder where (CREATEDTIME >= (UNIX_TIMESTAMP(DATE('2013-07-24 00:00:00')) * 1000) and CREATEDTIME <= (UNIX_TIMESTAMP(DATE('2013-10-24 00:00:00')) * 1000))

Archived requests: 

delete from arc_workorder where (CREATEDTIME >= (UNIX_TIMESTAMP(DATE('2013-07-24 00:00:00')) * 1000) and CREATEDTIME <= (UNIX_TIMESTAMP(DATE('2013-10-24 00:00:00')) * 1000))

Note: Its always recommended to take a backup before performing the delete operation.