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
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
HI Eleanor,No worries. This is one of the best places to get tips and learn. How about something like ...
update T_EADDRESSSet html_ind = 'Y'where customer_no in (select customer_no from T_LIST_CONTENTS where list_no = 1234)
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!
Thank you!
It looks like between David's and Heath's answers you have what you need, but hang in there and do not be afraid to ask any more questions like this you might have, no matter how basic you think they are. Most of us started where you are right now (I know I did), and this community is full of nothing but support! We are always happy to help out.
They did! I'm a team of one so it's great to know that there's a bunch of really skilled people willing to help. Thanks all again.