select distinct m.fspro_userid, m.firstname, m.lastname, b.Broker_name from tbl_FSPro_members m inner join tbl_SMA_BrokerOfficeLink sma on sma.brokerId = m.ownerID inner join tbl_SEC_MemGrpLink mgl on mgl.fspro_userId = m.fspro_userId inner join tbl_ORG_AttributeLinks oal on oal.mstr_attrId = m.fspro_userId and oal.child_attrId = sma.brokerOfficeId inner join tblBrokers b on sma.brokerID = b.broker_id where m.fsl_tablecode = 'BRO' and sma.mfr_id = and sma.territoryId = 83 and m.staffmember = 1 and mgl.groupId IN (1361,534) and oal.mstr_attrTypeId = 34 and oal.child_attrTypeId = 27 order by firstname, lastname