Prova cosi
codice HTML:SELECT `Nome`,`idcat1`,`idcat2`,`idcat3`,`posizione`, case when idcat1 = 1 then 1 else (case when idcat2 = 1 then 2 else (case when idcat3 = 1 then 3 else 100 end) end) end as prio FROM `tabella` where idcat1 = 1 or idcat2 = 1 or idcat3 = 1 order by prio, posizione