0

I am trying to insert into table with multiple queries. And its not working, here is my work.

    insert into post_topics_ta (id,post_id,topic_id,confidence_score) 
SELECT * FROM post_topics WHERE post_id in
(SELECT id FROM posts WHERE date_posted::date BETWEEN '2019-12-30' and '2020-01-26')

But this is not inserting any values into the target table. Could anyone please let me know how to achieve this?

Thanks in advance!!!

  • this is not inserting any values into the target table This can be due to: 1) non-inserted values do not match WHERE condition 2) they caused some unique index violation. Try to reproduce this on some online fiddle, and post the link to it. PS. Use INNER JOIN or NOT EXISTS instead of WHERE NOT IN. – Akina Jan 31 at 4:40
  • @Akina Thank you I resolved this issue. I changed my query formats. – prabhu Feb 4 at 10:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.