INSERT INTO table (a,b,c) VALUES (1,2,3) ON DUPLICATE KEY UPDATE a='4', b='5', c='6'
如果可能,如何在单个语句中的Rails中实现这种类型的SQL(插入和更新)
You can run your sql directly:
sql = "INSERT INTO table (a,b,c) VALUES (1,2,3) ON DUPLICATE KEY UPDATE a='4', b='5', c='6'"
ActiveRecord::Base.connection.insert_sql sql
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.