with pastDueInteractions as ( select distinct interactionId, interactionTk, partnerName, interactionDate, salesRepId, salesRepFirstName, salesRepLastName from tbl_DW_interactions#_tableSuffix# with (nolock) where interactionDate < cast( getDate() as date ) and disposition = '?' and territoryId in ( ) and salesRepId in ( ) and ( 1 = 2 or territoryPath like ) and salesRepId in ( ) and salesRepOwnerType = ) select *, case when salesRepId > 0 then salesRepFirstName + ' ' + salesRepLastName else cast( null as varchar ) end as salesRepFullName from pastDueInteractions order by interactionDate for json auto, include_null_values