我有一张桌子
files
我想为一个发现重复项的用户更新多行,例如
目前,我有(userID, fileID, fileName, folderID, folderName).谁在userID=12 filesfolderName下都有'work'
我想将folderName更新为folderID of '1',但保持相同的'work1'
这是我当前的sql语句,我无法使用它:

UPDATE files SET fileFolder = '$folderName'
WHERE folderID = '$folderID' AND userID = '$userID'

最佳答案

UPDATE files SET fileFolder = '$folderName'
WHERE folderID = '$folderID' AND userID = '$userID'

您是否尝试使用folderName而不是设置fileFolder?例如。。
UPDATE files SET folderName= '$folderName'
WHERE folderID = '$folderID' AND userID = '$userID'

关于php - MySQL更新具有相同值的多行,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/21200186/

10-09 03:46