下列 Sql 可用 in,建议用 exists
SELECT * FROM coldknow a WHERE EXISTS ( SELECT title, img FROM coldknow GROUP BY title, img HAVING (COUNT(1) > 1 AND a.title = title AND a.img = img) ) AND NOT EXISTS (SELECT MIN(id) FROM coldknow GROUP BY title, img HAVING COUNT(1) > 1 AND MIN(id) = id )
a 作为父表与虚拟子表进行关联,前 exists 存在父表字段与虚拟表相同的特征,后 exists 排除最小 id 的行,即保留重复记录中最小 id 的行