1

I want to do something like this in golang

    update test as t set
        column_a = c.column_a,
        column_c = c.column_c
    from (values
        ('123', 1, '---'),
        ('345', 2, '+++')  
    ) as c(column_b, column_a, column_c) 
    where c.column_b = t.column_b;

Where I am updating multiple rows in one round trip

Is there a way I can do this with prepare like stmt.Exec(vals...) where vals = []interface{}

user10714010
  • 865
  • 2
  • 13
  • 20
  • Note that the linked duplicate does not use [`prepare`](https://pkg.go.dev/database/sql#DB.Prepare). If you want to use prepare to create and reuse the statement, you'll need to always pass in the same number of `vals`, because if you don't then the `Exec` will fail. – mkopriva Jul 25 '21 at 07:45

0 Answers0