易截截图软件、单文件、免安装、纯绿色、仅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 / 疑难问题

现在有两张表:文章主表A(articleId,articleTitle),文章评论表B(commentId,articleId,commentTitle)
现在我想实现这样的功能:列出文章列表,其中每篇文章标题下面列出此文章的前2个文章评论,请问sql语句怎么写啊 ......

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

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

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

求个vb中的sql语句的写法,次sql语句的用法是分页程序
我写的如下:其中A是用来接收每页显示的记录的条数,B是用来接收显示的当前的页面.
sqltext="select top A * from log where id not in(select top ( ......

mysql区没高手 - MS-SQL Server / 基础类

我觉得mysql和sqlserver有共同的地方:
有个问题是关于表的锁问题:
进程A 进程B
select * from user where id in lock share mode(共享锁)
&nb ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号