select spl.ownerId, spl.ownerType, spl.opportunityId from tbl_SPL_Opportunities spl inner join tbl_SPL_stages stg on stg.stageId = spl.stageId where ( refCommissionRate is null or ( stg.statusCode = 'C' and availableDate >= )) and spl.ownerId > 0 and spl.ownerId <> 203 and spl.ownerType = 'BRO' order by spl.ownerId
#Now()#
#Now()#
#qmd_opportunities.recordCount#