Possible Duplicate:
How to delete duplicate rows with SQL?
I have this query which returns duplicate rows from a table in terms of the same name and year.
How can I delete the duplicate records, so there will only be unique values in the table?
The query is:
SELECT movies.movie_name, movies.year
FROM movies
INNER JOIN
(
SELECT movie_name, year
FROM movies
GROUP BY movie_name,year
HAVING count(movie_id) > 1
) dup
ON movies.movie_name = dup.movie_name
and movies.year = dup.year