select * from table where LENGTH(name) - LENGTH(REPLACE(name, 'a', '')) between 1 and 2 Atualizado para usar entre.