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'
精彩评论