select partnerid, partnertype from tbl_crm_interactions where ownerid = and ownertype = and interactionid = select case when osd.subjectDetailId is not null then osd.subjectDetailId else opp.subjectid end as subjectDetailId, case when osd.subjectDetailId is not null then osd.SubjectDetailType else opp.subjectType end as subjectDetailType, opp.availabledate, opp.stageid, QuantityAmt, QuantityUnit, DurationAmt, DurationUnit, UpdateDate, caseAmt, opp.typeCode from tbl_spl_opportunities opp left outer join tbl_SPL_OpportunitySubjectDetails osd on osd.opportunityid = opp.opportunityid and osd.ownerid = opp.ownerid and osd.ownertype = opp.ownertype and osd.SubjectDetailType = 'sku' where opp.ownerid = and opp.ownertype = and opp.partnerid = and opp.partnertype = and opp.stageid in () select availabledate, stageid, UpdateDate, QuantityAmt, QuantityUnit, DurationUnit, caseAmt, typeCode from qryOppDetails where subjectDetailId = and subjectDetailType = ---> update tbl_crm_interactions set dispositionDate = getdate() where ownerid = and ownertype = and interactionid =