读书人

帮小弟我看看这个查询语句有什么有关问

发布时间: 2012-12-31 11:57:52 作者: rapoo

帮我看看这个查询语句有什么问题?
update xx_hy_info set xx_hy_info.hy_num=b.hy_num
from (select hy_id,sum(hy_num_move) as hy_num
from hy_num_move_ls group by hy_id) b
where xx_hy_info.hy_id=b.hy_id

上面语句在sql server中执行正常,但是把数据库换成access之后,就无法执行了,提示“操作符丢失”。什么原因呀?
[解决办法]

update xx_hy_info 
set xx_hy_info.hy_num=b.hy_num
from xx_hy_info a
left join (select hy_id,sum(hy_num_move) as hy_num from hy_num_move_ls group by hy_id) b
on a.hy_id=b.hy_id

[解决办法]

--类似这样在情况
update bb b left join aa a on b.id = a.id set b.name = a.name



update
xx_hy_info a
left join (select hy_id,sum(hy_num_move) as hy_num from hy_num_move_ls group by hy_id) b
on a.hy_id=b.hy_id
set a.hy_num=b.hy_num



读书人网 >.NET

热点推荐