How to delete multiple rows with 2 columns as composite primary key in MySQL?

后端 未结 1 914
轻奢々
轻奢々 2020-12-29 18:23

My innodb table has the following structure: 4 columns (CountryID, Year, %Change, Source), with the 2 columns (CountryID, Year) as the primary key.

相关标签:
1条回答
  • 2020-12-29 18:53

    The answer in Oracle is:

    delete from cpi
     where (countryid, year) in (('AD', 2010), ('AF', 2009), ('AG', 1992))
    

    It's fairly standard SQL syntax and I think MySQL is the same.

    0 讨论(0)
提交回复
热议问题