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.
我有一个数据库表,用于存储患者信息以及图像和 Word 文档等文件。更新此表时,它会覆盖以前存储的数据。我该如何防止这种情况发生?
根据您的评论,首先您需要将旧值备份到具有相同列数据类型的其他表中:
insert into backup_table ( column1 , column2 , ... ) SELECT column1 , column2 , ... FROM orginal_table
然后更新语句应如下所示:
UPDATE orginal_table SET column1=form_value1, column2=form_value2 ,... WHERE some_column=some_value