// Creating the as-is where for the subQuery, checks that the required association exists
// 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.quoteTable(table,as)+" WHERE "+where+" LIMIT 1) IS NOT NULL")