Clay Icon

How to Fix Write to Table Column in SQL to Avoid Duplicates?

Β·
Β·

When I updated a "write to table" column, it duplicates every record on the new table rather than updating the current records. I've just burned thousands of credits. How do I ensure that if I update the "write to table" column, it will only UPDATE the records on the new table, not add all the records again?

  • Avatar of Clay Team
    Clay Team
    APP
    Β·
    Β·

    Hey hey! Can you drop the URL for your table here? (if applicable) 🫢 Don't worry, only admins will be able to open your table πŸ˜‰

  • Avatar of Aaron R.
    Aaron R.
    Β·
    Β·

    I would like to clear the new table and start fresh, but I've already found hundreds of work emails.

  • Avatar of Clay Team
    Clay Team
    APP
    Β·
    Β·

    Hey Aaron!! Unfortunately, Write to table doesn't have a "lookup" function so it will only create a new record. Will ask if this could be added though.To append data that you may have missed or generated after the row was created, it's best to use Lookup Record. Here's a video and our docs page for Lookup Record!

  • Avatar of Clay Team
    Clay Team
    APP
    Β·
    Β·

    How many credits did you use? happy to help with that

  • Avatar of Aaron R.
    Aaron R.
    Β·
    Β·

    Yes, a lookup function within "write to table" would be useful. I will check out the video- tysm. I burned just about 12k credits bc my find email waterfall ran on the duplicated records.

  • Avatar of Clay Team
    Clay Team
    APP
    Β·
    Β·

    Cool, just added the credit back into the account :) And yeah, in the meantime, the two best options here would be to: 1. Ensure you're writing over all the data you need 2. or use Lookup Record to append that information with any updates that were missed. Until that feature can be added, this is the way to go!