combinar CONCAT() e GROUP_CONCAT() : SELECT MD5(GROUP_CONCAT(CONCAT(col1,col2,...))), 1 as g FROM some_table GROUP BY g;