codice:select id,substring_index(group_concat(campo order by campo),',',1) as minore from ( select id,campo1 as campo from tabella where campo1 > 0 union all select id,campo2 from tabella where campo2 > 0 union all select id,campo3 from tabella where campo3 > 0 union all select id,campo4 from tabella where campo4 > 0 union all select id,campo5 from tabella where campo5 > 0 ) as t group by id