开发者

delete records from a table based on data from a different table

table1 h开发者_如何学JAVAas column CITY and COUNTRY. table2 has column CITY.

how do i delete from table2 all records that have CITY in common with table1 but also the COUNTRY='Russia' ??

please keep in mind that both tables have about 1 million rows of data


DELETE table2
FROM table2 INNER JOIN table1
   ON table2.CITY = table1.CITY
WHERE table1.COUNTRY = 'Russia'


You can use the multitable delete syntax:

DELETE table2
FROM table1
JOIN table2
ON table1.city = table2.city
WHERE table1.country = 'RUSSIA'
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜