老师指点指点
能用update 更新下别的字查询里的字段 iscj吗
(select b.username,b.iscj from
(select a.username ,a.iscj,(yf-xf) as bb
,case when StartLevel=1 then 100000
when StartLevel=3 then 300000
when StartLevel=6 then 600000
when StartLevel=10 then 1000000
end as cc
from sys_user a where isok=1) as b
where b.bb> = cc )
他的运行结果是
useranaem iscj
a 0
b 0
我怎么更新iscj的只为1
------解决方案--------------------update a set a.iscj=1 from sys_user a,(select a.username ,a.iscj,(yf-xf) as bb
,case when StartLevel=1 then 100000
when StartLevel=3 then 300000
when StartLevel=6 then 600000
when StartLevel=10 then 1000000
end as cc
from sys_user a where isok=1) b where a.username=b.username and b.bb> b.cc
------解决方案--------------------1 update 只能更新表,能更新查询结果
2 iscj 是哪个表的列?
3 你还是把表结构、数据,以及你想要的结果贴出来吧。