易截截图软件、单文件、免安装、纯绿色、仅160KB

msSql 修改时间字段 - MS-SQL Server / 基础类

表A
SQL code:
autoID outDate type resultDate
1 2010-05-10 11:12:03 1 null
2 2010-05-10 15:10:03 0 null
3 2010-05-12 11:12:03 0 null
4 2010-05-14 11:12:03 1 null
5 2010-05-15 11:12:03 1 null
现在我想更改表A里的 resultDate 字段
如果type为0,resultDate 改为 outDate 加上20天后的结果
如果type为1,resultDate 改为 outDate 加上30天后的结果

修改后的结果应该为:
SQL code:
autoID outDate type resultDate
1 2010-05-10 11:12:03 1 2010-05-30 11:12:03
2 2010-05-10 15:10:03 0 2010-06-09 15:10:03
3 2010-05-12 11:12:03 0 2010-05-11 11:12:03
4 2010-05-14 11:12:03 1 2010-06-03 11:12:03
5 2010-05-15 11:12:03 1 2010-06-04 11:12:03

哪位知道的帮我解决下
谢谢
SQL code:
update ta
set resultDate=(case when [type]=0 then dateadd(day,2


相关问答:

SQL如何优化问题 - MS-SQL Server / 疑难问题

今天做了一个存储过程   环境是SQL2000数据库  
大致如下
建立临时表
定义员工游标
        循环员工(属于1个公司)  
        ......

求一SQL - MS-SQL Server / 基础类

tab1 字段:billdate,goodsid,incount,inmoney,outcount,outmoney,endprice,endcount,endamt
tab2 字段:goodsid,goodskind(商品类型)
tab3 字段:goodskind(商品类型),kindname
结果:
得到商品类型在一段时间 ......

SQL语句问题 - MS-SQL Server / 疑难问题

请教高手:
 以下是数据库中的三条记录,英文为字段名称  
  id planname TaskBeginTime Status
329 2010年03 ......

关于Vb中sql语句的写法(100分) - Java / Web 开发

求个vb中的sql语句的写法,次sql语句的用法是分页程序
我写的如下:其中A是用来接收每页显示的记录的条数,B是用来接收显示的当前的页面.
sqltext="select top A * from log where id not in(select top ( ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号