Thank you Christian, I've just tested the query and it works! I had to use CONCAT(col1, '\0', col2) since the double pipe inside COUNT throws a syntax error.