再讨论如何把上面的a行对应的数据更新到b行? 更正一下数据不改,只要是select的别的方法.数据改了就变成结果 NUll m NUll n NUll ya lpglpg ulpg f 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 请问,当数据如下:b mb nb ya lpgb ub f楼主希望得到怎样的结果? select id=identity(int),* into #1 from testselect [co1]=case when co1='b' then(select top 1 co2 from #1 where co1='a' and id<a.id order by id desc) else co1 end,co2 from #1 a 更正一下数据不改,只要是select的别的方法.----------------------------------------什么意思,是用select 还是不用select ..? 他要的是update吧,select 可以不用 case,select ta.*,(select top 1 b from @a tb where tb.c<ta.c and tb.a ='a' and ta.a<>'a' order by tb.c-ta.c desc) from @a ta 高手帮忙解答下这个存储过程,有些语句看不懂 Sql 字符串拆分 一个较高级的查询问题 问一个关于子查询的问题! Like fName 'A%' 与 Like fName 'A' + '%'的区别! 简单存储过程问题,结束立即结帖!! 求解:SQL错误捕获问题 sql里计算:发布信息时间距离当前时间为 几年几月几日几小时几分钟之前 200分的问题!关于定时将数据库导入到MSSQL数据库当中! 在vc++中,怎么调用远程的 sevlet? 难吧! 收缩数据不成功,错误如下。 Create database 中是否可以使用变量?
b m
b n
b y
a lpg
b u
b f楼主希望得到怎样的结果?
select [co1]=case when co1='b' then
(select top 1 co2 from #1 where co1='a' and id<a.id order by id desc)
else co1 end,co2 from #1 a
----------------------------------------
什么意思,
是用select 还是不用select ..?
select ta.*,(select top 1 b from @a tb where tb.c<ta.c and tb.a ='a' and ta.a<>'a' order by tb.c-ta.c desc) from @a ta