http://expert.csdn.net/Expert/topic/1375/1375432.xml?temp=.8570978
解决方案 »
- 表已删除,sysobjects中还能找到记录
- 内连续上班等于或大于4天的员工
- sql2005数据库怎么迁移到sql2000
- 在一个表中设了一个自动编号的字段,我将数据删除了后想重新加入,如何使编号从1开始?
- 寻找个思路
- 如何计算工作日问题
- 有关SQL SERVER 2000里面的系统数据(master)中的存储过程
- 一个字段为空<NULL>如何判断?
- 怎样用vc、vb向数据库中添加二进制的数据(比如binary类型),怎样把一个对象存到数据库中
- sql 2000 定位问题,请大虾出手相助!
- 就70分了,问题解决另外起贴送100分.XP环境下连接sql server7.0数据库的问题.
- 我的nvarchar出现问题!
select * from #t
字段为 F1 F2 F3 F4如下即可:
update table set F4 = F3
while @@Rowcount > 0
begin
update a set F4 = b.F3 from table a
join table b on a.F4 = b.F1
where a.F4 not in ('0','1')
end
(select 列3 from yourtable where 列1=列3) 列4 end into #t from yourtable
select * from #t
2:我觉得没有比如下语句更简单的了。
Select F1,F2,F3,F3 as F4 into #tmp from table
while @@Rowcount > 0
begin
update a set F4 = b.F3 from #tmp a
join #tmp b on a.F4 = b.F1
where a.F4 not in ('0','1')
end
Select * from #tmp
case when not ok.b is null then ok.b
when not ok.e is null then ok.e
when not ok.h is null then ok.h
when not ok.k is null then ok.k
when not ok.n is null then ok.n
when not ok.q is null then ok.q
else ok.t
end
as dd
--,ok.*
from
(
select ppppp.*,g.a s,g.总公司 t,g.b u
from
(select pppp.* ,f.a p,f.总公司 q,f.b r
from
(select ppp.*,e.a m,e.总公司 n,e.b o
from
(select pp.*,d.a j,d.总公司 k,d.b l
from (select p.*,
c.a g,c.总公司 h,c.b i
from (select a.a a,a.总公司 b,a.b c,
b.a d,b.总公司 e,b.b f
from chen a
right join chen b on a.a=b.b)
as p
right join chen c on p.d=c.b)
as pp
right join chen as d on d.b=pp.g)
as ppp
right join chen as e on e.b=ppp.j)
as pppp
right join chen as f on f.b=pppp.m)
as ppppp
right join chen as g on g.b=ppppp.p
) as ok
order by aa,bb,cc要这么麻烦吗??