I want to grab a list of values from an SQL table, and then run a query using each of these values to update other fields in the same table. In another language, I'd use a for loop for this, but I've read that looping operations should be avoided/aren't supported in SQL.
Conceptually (obviously the code isn't valid), this is what I'm trying to achieve:
my_list = SELECT item_id
FROM my_table
WHERE value = "my_value"
AND field_id = 1
for x in my_list:
UPDATE my_table
SET meta_value = "my_value"
WHERE field_id = 2
AND item_id = x
What's the proper way to achieve this is SQL please?