I would like to display all the columns of the duplicate values in MYSQL.
I am selecting the duplicate values in MYSQL based on this post:Finding duplicate values in a SQL table.
MY sql statement looks like this:
SELECT
`subject`, `topic`, `sub_topic`, `difficulty`,`question_number`,`question_version`, COUNT(*)
FROM
`qz_question`
GROUP BY
`topic`, `sub_topic`, `difficulty`,`question_number`,`question_version`
HAVING
COUNT(*) > 1
Instead of Grouping by the columns, I would like to display all the columns of all the duplicate values in the database.
I have tried this:
SELECT
*
FROM
`qz_question`
GROUP BY
`topic`, `sub_topic`, `difficulty`,`question_number`,`question_version`
HAVING
COUNT(*) > 1
For example, for each unique row, there is a duplicate. It should display both the unique and the duplicate together at the same time.But this displays only one unique row. I want the duplicate as well.