access中查询问题,急啊!!在线等10小时,求高手回答

lone2003 2003-10-16 11:37:12
据Sheet1中任何人的AA查Sheet2中和AA(在Sheet2中唯一)所对应的该人的职称(字段1的值)及工资档次(表中字段名),且要将这两结果分别填在Sheet1中字段3和字段4
Sheet1
BH XM 字段3 字段4 AA AB
1001 李新国 879 377
1002 赵运林 915 392
Sheet2
字段1 一档 二档 三档 四档 五档
正高 785 850 915 995 1075
副高 576 619 662 705 748
...全文
29 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
520zyb 2003-10-16
  • 打赏
  • 举报
回复
据Sheet1中任何人的AA查Sheet2中和AA(在Sheet2中唯一)所对应的该人的职称(字段1的值)及工资档次(表中字段名),且要将这两结果分别填在Sheet1中字段3和字段 :
select AA,职称,档次 into #tb from Sheet2 where AA in (select AA from Sheet1)
select #tb
go top
do while not eof()
update Sheet1 set 字段3=#tb.职称,字段4=#tb.档次 where AA=#tb.AA
skip
enddo
changechange 2003-10-16
  • 打赏
  • 举报
回复
currentproject.connection.execute "select AA,职称,档次 into tb from Sheet2 where AA in (select AA from Sheet1)"
dim rs as new adodb.recordset
rs.open "select * from tb",currentproject.connection,1,1
do until rs.eof
currentproject.connection.execute "update Sheet1 set 字段3='"& rs("职称") &"',字段4='"&rs("档次")&"' where AA='"&rs("aa")&"'"

loop

7,712

社区成员

发帖
与我相关
我的任务
社区描述
Microsoft Office Access是由微软发布的关系数据库管理系统。它结合了 MicrosoftJet Database Engine 和 图形用户界面两项特点。
社区管理员
  • Access
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧