select ownerId, ownerType, requestId, renewalOptionWorkflowId, 0 workflowTradeRequestId, termStart, termEnd
from tbl_TPM_Requests
where renewalOptionWorkflowId > 0
-- and ownerId = 54
-- and requestId =12883
select config
from tbl_WRK_UserRequests
where ownerId =
and ownerType =
and requestID =
select * from qmd_toCheck where requestId <> workflowTradeRequestId
order by ownerId, ownerType, termEnd desc
update tbl_TPM_Requests
set renewalOption = '?', renewalOptionUserId = null, renewalOptionDate = null, renewalOptionWorkflowId = null
where requestId =
and ownerId =
and ownerType =