I find that gorm has [Upsert / On Conflict] feature, but that means "create NEW and update if exists", it will create new record. BUT I only want to update the existed record and ignore the one that not exist, e.g.

update table1 set address = case id when 1 then 'xxx' end where id in (1,2,3)

Comment From: github-actions[bot]

The issue has been automatically marked as stale as it missing playground pull request link, which is important to help others understand your issue effectively and make sure the issue hasn't been fixed on latest master, checkout https://github.com/go-gorm/playground for details. it will be closed in 2 days if no further activity occurs. if you are asking question, please use the Question template, most likely your question already answered https://github.com/go-gorm/gorm/issues or described in the document https://gorm.io ✨ Search Before Asking

Comment From: li-jin-gou

hello, you can use SQL Expression to solve it. doc: https://gorm.cn/docs/update.html#Update-with-SQL-Expression

Comment From: github-actions[bot]

The issue has been automatically marked as stale as it missing playground pull request link, which is important to help others understand your issue effectively and make sure the issue hasn't been fixed on latest master, checkout https://github.com/go-gorm/playground for details. it will be closed in 2 days if no further activity occurs. if you are asking question, please use the Question template, most likely your question already answered https://github.com/go-gorm/gorm/issues or described in the document https://gorm.io ✨ Search Before Asking

Comment From: wintrysky

hello, you can use SQL Expression to solve it. doc: https://gorm.cn/docs/update.html#Update-with-SQL-Expression

I dont think SQL Expression can resolve it, for example,

I have 100 rows need to update whith the column "address" : addr1 = "sz" addr2 = "sh" addr3 = "123" addr4 = "#$%^" that means there no rule to set the Expression

update table1 set address = case id when 1 then 'sz' when 2 then 'sh' when 3 then '123' when 4 then '#$%^' end where id in (1,2,3,4)

Comment From: github-actions[bot]

The issue has been automatically marked as stale as it missing playground pull request link, which is important to help others understand your issue effectively and make sure the issue hasn't been fixed on latest master, checkout https://github.com/go-gorm/playground for details. it will be closed in 2 days if no further activity occurs. if you are asking question, please use the Question template, most likely your question already answered https://github.com/go-gorm/gorm/issues or described in the document https://gorm.io ✨ Search Before Asking