// If its a multi association we need to add a where query to the main where (executed in the subquery)
// If its a multi association we need to add a where query to the main where (executed in the subquery)
if(subQuery&&association.isMultiAssociation){
if(subQuery&&association.isMultiAssociation){
if(!options.where)options.where={}
if(!options.where)options.where={}
// Creating the as-is where for the subQuery, checks that the required association exists
options.where["__"+as]=self.sequelize.asIs("(SELECT "+self.quoteIdentifier(attrRight)+" FROM "+self.quoteIdentifier(tableRight)+" WHERE "+where+" LIMIT 1) IS NOT NULL")
options.where["__"+as]=self.sequelize.asIs("(SELECT "+self.quoteIdentifier(attrRight)+" FROM "+self.quoteIdentifier(tableRight)+" WHERE "+where+" LIMIT 1) IS NOT NULL")