Say I have a table with column key and column date. I'd like to view entries with duplicate key values along with their date. The below query will give the duplicate key values, but gives an error if I add date to my SELECT statement. How can I view the date of the duplicates?
SELECT key, count(*) FROM tbl
GROUP BY
KEY
HAVING
count(*) > 1