I have a table called _field. Now, for some reason, a field inside the table called block got messy and now contains the wrong block numbers.
I have the default data for _field, but some of the other fields can no longer be at default because of foreign constraints and stuff, so, I can’t just restore the default data.
So, for now, I created a new table called tmp_field and populated it with the default _field data.
Now, I need a query that takes the data from _field and changes all of the block numbers in _field to match the block numbers from tmp_field.
Another way to phrase it would be:
It checks each row of _field and if some field (like fieldid or name) matches the same field in tmp_field, then it changes the value of block in _field to match the value of block in tmp_field.
Note: I am using Postgresql 9.1.
Thanks for everything.
1 Answer