How do I remove duplicate records in a join table in PostgreSQL?
-
31-10-2019 - |
题
I have a table that has a schema like this:
create_table "questions_tags", :id => false, :force => true do |t|
t.integer "question_id"
t.integer "tag_id"
end
add_index "questions_tags", ["question_id"], :name => "index_questions_tags_on_question_id"
add_index "questions_tags", ["tag_id"], :name => "index_questions_tags_on_tag_id"
I would like to remove records that are duplicates, i.e. they have both the same tag_id
and question_id
as another record.
What does the SQL look like for that?
没有正确的解决方案
不隶属于 dba.stackexchange