How to delete duplicates in SQL table based on multiple fields

后端 未结 9 496
星月不相逢
星月不相逢 2020-12-04 14:58

I have a table of games, which is described as follows:

+---------------+-------------+------+-----+---------+----------------+
| Field         | Type                


        
9条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-04 15:35

    DELETE FROM table
    WHERE id = 
        (SELECT t.id
        FROM table as t
        JOIN (table as tj ON (t.date = tj.data
                              AND t.hometeam_id = tj.hometeam_id
                              AND t.awayteam_id = tj.awayteam_id
                              ...))
    

提交回复
热议问题