Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
简而言之,我正在尝试使用gorm 包执行以下操作。
UPDATE TableName t SET t.col1 = t.col2;
有没有办法让gorm只做1个查询?
您可以使用 Gorm 方法执行此操作
db.Table("TableName t").Update("t.col1", gorm.Expr("t.col2"))
来源:https ://github.com/jinzhu/gorm/issues/1947#issuecomment-397376537