Merge rows as one field

GROUP_CONCAT(fieldname ORDER BY fieldname ASC SEPARATOR ',')

Full code usage example:

SELECT email, studentname,
GROUP_CONCAT(matrixno ORDER BY matrixno ASC SEPARATOR ',') AS matno,
COUNT(email) AS NumOccurrences
FROM users
GROUP BY email
HAVING ( COUNT(email) > 1 )

Code above used to find duplicates for email.

Facebook Twitter Email

Leave a Comment


9 + = 17


NOTE - You can use these HTML tags and attributes:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>