Really basic SQL Query

Hi everyone,

Apologies about the basic SQL query, but I was wondering if someone could help?  I'm only 4 months in with my SQL and still very much a beginner!  For some reason I've been going in circles trying to update a field but unfortunately I get the red wiggly line of doom on every configuration I try. 

I would like to update the allow_html field in the T_EADDRESS table.  I have the constituents I'd like to change this on in a list, so I've been trying to link T_EADDRESS and T_LIST_CONTENTS.

What would be the best way to do this please?

Thanks in advance!

Eleanor  

Parents
  • Hi Eleanor,

    This query should do the trick assuming you are trying to set html_ind to 'Y'. Replace 12345 with your list_no. You can add additional statements to filter the data further if needed. It is a good idea to test updates in a test environment first.

    UPDATE a 
    SET    a.html_ind = 'Y' 
    FROM   t_eaddress a 
           INNER JOIN t_list_contents b 
                   ON a.customer_no = b.customer_no 
    WHERE  b.list_no = 12345 

    I hope this helps!
    David

  • Brilliant, thank you!  I spend most of my time in our test environment at the moment - always get a bit nervous when deploying changes to our live database!

Reply Children
No Data