数据库语句如下
if (select reply from consult )is not null update consult set condition = '已回答' else update consult set condition='未回答'
问题:当reply有值,不为空时, condition为 已回答,,如果reply为空时, condition为未回答。花絮:我在语句中都加入where id ='固定值',语句就通的,我想批量操作,该如何处理?都大神啊
if (select reply from consult )is not null update consult set condition = '已回答' else update consult set condition='未回答'
问题:当reply有值,不为空时, condition为 已回答,,如果reply为空时, condition为未回答。花絮:我在语句中都加入where id ='固定值',语句就通的,我想批量操作,该如何处理?都大神啊
解决方案 »
- 方法多少个参数才算多!
- DataGridView 不显示数据 指点一下一下代码那里不对!有别的好方法也可以提 谢谢各位了
- txtbox的问题?
- .txt和.jpg等格式附件不能打开
- 个人无法解决的小问题(关于visual studio.net)
- 怎样检测网络是否通畅?
- 请问如何判断DATAGRIDVIEW光标是在NewRowIndex上
- 求助各位大神一段C#代码,是关于C#控制打印机的一段代码,我不是太懂,求各位指导一下,谢谢
- 急:关于“安装与部署项目”(就这么多分了)
- 请教大家一个devexpress gridview控件间隔行变色的问题
- C# Thread问题急求!!
- 在线人数和访问人数统计以及获取当前动态时间
update xxxxxxxxxxxxxxxxxxxxxxx
select xxx from xxx
update xxxxxxxxxxxxxxxxxxxxxxx
写个循环SQL语句在SQL执行一下
begin
update consult set condition = '已回答'
end
else
begin
update consult set condition='未回答'
end这样写
update consult set condition = '已回答' where reply is not null 分2部写,先覆盖掉
你要分两部分写的话,第一句也加上where,能少刷几条记录
update consult set condition =(case when reply =null then '未回答' else '已回答' end)
测试通过
update consult set condition =(case when reply is null then '未回答' else '已回答' end)