I have two tables
articlesdownloadtrack with columns – id, articleid, createdtime, modifiedtime
articles with columns – id, articlename, articleURL, createdtime, modifiedtime
Some of the entries in articlesdownloadtrack i.e. articlesdownloadtrack.articleid are not available in articles(missed during the process of migration). I want to remove such records.
I am using the query
delete from articlesdownloadtrack where articleid not in(select id from articles);
But I have to add a constraint to delete only those records whose articleid is not null, because in articlesdownloadtrack, there are some records whose articleid is NULL, which should not be deleted when this query is executed.
As mentioned @njk , try this :