Direct code
SELECT
id,
koto
FROM
hitokoto
WHERE
koto IN (SELECT t1.koto FROM hitokoto t1 GROUP BY t1.koto HAVING COUNT(1) > 1)
AND id NOT IN (SELECT MIN(id) FROM hitokoto t1 GROUP BY t1.koto HAVING COUNT(1) > 1)
Remove those with the same koto and keep the ones with the smallest id.
Retrieve all rows that have the same koto, find the smallest ones, and then use not in
.
It seems a bit slow.