Deleting rows repeating

admin

Administrator
Staff member
I'm trying to delete all rows that are repeating so that only one unique row of that specific data remains.

Right now, I'm doing this by creating a temporary table from the result set of the column of data repeating as a GROUP:

CREATE TABLE files_temp AS SELECT * FROM files GROUP BY file;

Then I drop the old table:

DROP TABLE tella_files;

Then recreate a new table with the new data:

CREATE TABLE files AS SELECT * FROM files_temp;

Then drop the old temporary table:

DROP TABLE files_temp;

Is there a way I can do all of this with just one query. I tried using DISTINCT, but can't get it working like I wanted.
 
Back
Top