I hope I can help you out - could you please upload your SQL script file (e.g. at wikisend.com) , or just copy/paste the text in this thread?
I'd like to have a look.
Generally, you'd use an update statement to change some or all columns in some or all rows of your table; but I image you've seen that.
With the mild complexity of your query batch (2 separate statements? ) I'd have to see your source table definition (schema & sample data) and the actual output from your query to assemble an update statement. BUt in all likelihood, you'll need a form of the UPDATE ... SELECT pattern, check this out: