道歉说我是SQL方面的新手。所以,让我把下面的场景放在学生桌上。
> Roll_Number Student_Name isActive Relieved_Date
> ----------------------------------------------------------
> 101 John True NULL
> 102 Bob False 2015-01-20 00:00:00.000
> 103 Joe True NULL
> 104 Mike True NULL
> 105 Steve False 2014-04-12 00:00:00.000
> 106 Lia True NULL
> 107 Maya True NULL
> 108 Gordon True NULL
现在我想将forActive列更新为False,其中Relieved_Date = 2015-01-20 for Roll_Number - 101,104,107,108
非常感谢您能帮助我。
答案 0 :(得分:1)
UPDATE Student
SET Relieved_Date = '2015-01-20',
isActive = 'False'
WHERE Roll_Number IN (101, 104, 107, 108)
答案 1 :(得分:1)
使用{/ 1}}语句,如
UPDATE
可能是错误的解释但是你说你想设置update student
set isActive = false
where Roll_Number in (101, 104, 107, 108)
and Relieved_Date = '2015-01-20 00:00:00.000';
如果是,那么也包括Relieved_Date = 2015-01-20
语句
SET
答案 2 :(得分:1)
这有助于......
update YourTable
set isActive = 'False', Relieved_Date = '2015-01-20 00:00:00.000'
where Roll_Number in (101,104,107,108)