g*****r 发帖数: 130 | 1 How do I compare two rows to see if they are exactly the same? This means if
all fields are the same for the two rows, the two rows are considered dupes
. How could I remove the dupes quickly?
For example, I have a table called "game_play", and it contains columns
player_id, game_name. I can remove dupes like this:
delete from game_played a
where a.rowid > ( select b.rowid from game_played b
where a.player_id = a.player_id
and a.game_name = b.game_name)
It works, but what if I have 100 columns in the table, do I list all column
names out in the above query? That sounds silly. Any good method out there
that I can write the query quick??
Thank you very much!! | T****U 发帖数: 3344 | 2 try this, which is a little less silly
delete from test1 where rowid not in (select min(rowid) from test1 group by
key1, key2, key3,...);
if
dupes
column
【在 g*****r 的大作中提到】![](/moin_static193/solenoid/img/up.png) : How do I compare two rows to see if they are exactly the same? This means if : all fields are the same for the two rows, the two rows are considered dupes : . How could I remove the dupes quickly? : For example, I have a table called "game_play", and it contains columns : player_id, game_name. I can remove dupes like this: : delete from game_played a : where a.rowid > ( select b.rowid from game_played b : where a.player_id = a.player_id : and a.game_name = b.game_name) : It works, but what if I have 100 columns in the table, do I list all column
|
|