PSQL Batch Update Statement

I am trying to update a bunch of rows in a psql database, and would like to do it in one generated sql statement if possible. I am able to generate batch insert statements which look similar to this:

INSERT INTO my_table (col1, col2, col3) 
VALUES (v11, v12, v13), (v21, v22, v23), ...

However I am not sure how to do this with an update statement instead. I could do one SQL statement for each row I want to update but this seems unnecessary and slower than having just one statement

P.S. all rows have an id column so I can reference them through that

Answers


Near Bottom of Page

I was able to find the answer at the above link. looks similar to

UPDATE my_table 
   SET x = case 
             when y = '1' then '1.1'
             when y = '2' then '1.2'
           end
WHERE y='1' OR y='2';

Need Your Help

Match URL link from input string

regex linux bash sed grep

How do I match the URL address in this string, I have other code that matches text and it seems to work, but when I try to use it here, it doesn't, it keeps saying there is "No such file or directo...

customize android Date like twitter and instagram news feed

java android simpledateformat android-dateutils

how can I customize the date format in an android development to be like that of twitter and instagram. What i have below my current code, but I don't like the format it produces like "11 minutes a...