这是我当前的查询
UPDATE `records` SET tester1 = '$user', tester1yn = '$pass'
我想将其更改为
UPDATE `records` SET
IF `tester1` IS NULL `tester1` = $user, AND `test1` = $pass
ELSE `tester2` = $user, `tester1yn` = '$pass'
WHERE `id` = $id
但正如我所拥有的那样,这是行不通的。我是否有一个嵌套问题,或者我正在以错误的方式解决这个问题?
基于反馈的更新
UDPATE records SET
tester1 = if(tester1 IS NULL,'$user',tester1),
tester1yn = if(tester1 is null, '$pass', tester1yn),
tester2 = IF(tester1 is not null, '$user', tester2),
tester2yn = IF(tester1 is not null,'$pass', tester2yn)
where id = $id
虽然还没有。