我有一个表,其中有一列名为article_title. 假设表名是articles. 我需要找出在article_title多条记录上数据相同的记录。
article_title
articles
这是我所拥有的:
select a.* from articles a where a.article_title = (select article_title from articles where article_title = a.article_title AND a.id <> articles.id)
您的问题可以通过以下查询解决:
SELECT * FROM article WHERE article_title IN (SELECT * FROM (SELECT article_title FROM article GROUP BY article_title HAVING COUNT(article_title) > 1) AS a);