Mysql: DELETE with IN subquery
DELETE FROM images WHERE image_id IN(
(SELECT i.image_id FROM images i
LEFT JOIN ads a ON i.ad_id=a.id
WHERE ISNULL(a.id))
)
开发者_StackOverflow社区
I need to accomplish this query. Any help will be appreciated. Thanks ;)
DELETE i
FROM images i
LEFT JOIN ads a ON i.ad_id=a.id
WHERE ISNULL(a.id)
精彩评论