有这种怪事??!!急,高手帮忙
我在VB中不可以执行“
update spmsb set jhdj=(convert(numeric(20,4),a.xykc*jhdj)- -1*17)/(a.xykc- -1) from spmsb,
(select spkcb.spidh as spidh,sum(xykc) as xykc from SPKCB,spmsb
where SPKCB.spidh=spmsb.spidh and spkcb.spidh=3158 group by spkcb.spidh) a
Where spmsb.spidh = a.spidh”该语句,但在SQL中就可以执行。请各位高手帮帮忙
------解决方案--------------------convert(numeric(20,4),a.xykc*jhdj)- -1*17
有的地方最好加上括号
是减负1*17?
同样的语句SQL中执行VB中是会执行的
------解决方案--------------------VB中写:
数据源.Execute "update spmsb set jhdj=(convert(numeric(20,4),a.xykc*jhdj)- (-1*17))/(a.xykc- (-1)) from spmsb
inner join (select spkcb.spidh as spidh,(case when sum(xykc)=-1 then 0 else sum(xykc) end )as xykc from SPKCB inner join spmsb
on SPKCB.spidh=spmsb.spidh and spkcb.spidh=3158 group by spkcb.spidh) a
on spmsb.spidh = a.spidh "
应该可以的 ,我经常这样写UPdate,要保证 (a.xykc- (-1)) <> 0的