CRM-13614: query optimization on dynamic groups using only one left join

This patch refers to this issue : 
http://issues.civicrm.org/jira/browse/CRM-13614