Bulk update sql

I have a table and I want to copy my row with some id to other rows in the same table. Any suggestions on best practices? How to make Bulk update?

example:

| id | foreign_key_id | param_a | param_b | created_at | updated_at |
| 1 | 23 | 23 | 44 | 2022-05-30 | 2022-05-30 |
| 2 | 35 | 32 | 22 | 2022-05-30 | 2022-05-30 |
| 3 | 13 | 12 | 33 | 2022-05-30 | 2022-05-30 |
| 4 | 12 | 33 | 11 | 2022-05-30 | 2022-05-30 |
| 5 | 55 | 18 | 22 | 2022-05-30 | 2022-05-30 |

I want to update rows with foreign_key_id 12 and 13 with the values of 23 for param_a and param_b.

TBH this question has nothing related to Go; it’s a “pure SQL” query

UPDATE <table_name>
SET
    param_a = 23
    param_b = 23
WHERE foreign_key_id IN (12, 13);

Am I missing something?

1 Like

Yeah its my bad i will remove it.

I was looking for something with better performance of some pattern for doing bulk updates and you are completely right with this answer my questions is dumb.