Separar número de um campo texto em Mysql select if(sum(CAST(<COLUNA>AS UNSIGNED))>8,8,sum(CAST(<COLUNA> AS UNSIGNED))) from <TABELA>