select obj.objName, otl.inserttype from tbl_crm_interactionparticipants ip with(nolock) inner join tbl_bcrm_objectivetrglink otl with(nolock) on otl.linkid = ip.participantid --and otl.inserttype = 'm' and otl.ownerid = ip.ownerid and otl.ownertype = ip.ownertype inner join tbl_bcrm_objectives obj with (nolock) on obj.objectiveid = otl.objectiveid and obj.ownerid = otl.ownerid and obj.ownertype = otl.ownertype where ip.interactionid = and ip.ownerid = and ip.ownertype = order by obj.objName select partnerId, partnerType, interactionDate from tbl_crm_interactions i with (nolock) where i.interactionid = and i.ownerId = and i.ownerType = select formId, formName from qmd_interactionForms