I am trying to insert data into a table feed.author from another table feed.tempXML. The First time I execute this statement it works perfectly fine, but when i add data in feed.tempXML and run it again the new authors are not being added into the feed.author table. Does the IF statement need to change ?
Code:
IF NOT EXISTS(SELECT DISTINCT t.author FROM feed.tempXML t
JOIN feed.author a ON a.author = t.author)
INSERT INTO feed.author(author)
SELECT DISTINCT author
FROM feed.tempXML
WHERE author IS NOT NULL
Aucun commentaire:
Enregistrer un commentaire