Solo necesitas usar GROUP BY
en lugar de DISTINCT
. Así que prueba esta consulta:
SELECT personid, COUNT(msg)
FROM mytable
GROUP BY personid
ORDER BY personid;
Solo necesitas usar GROUP BY
en lugar de DISTINCT
. Así que prueba esta consulta:
SELECT personid, COUNT(msg)
FROM mytable
GROUP BY personid
ORDER BY personid;