Access 2007 ...合并两个表 [英] Access 2007... Merge two tables
问题描述
提前全部感谢...
我有两张桌子......
公司......
ID corpname corpnumber address
1个小工具123456 1122 3
2 acme 234567 123 4th st
3个工程师345678 987墙st
等...
人员......
身份证号码类型fname lname
1 123456 pres john baker
2 123456 dir joe blow
3 123456 sec jane doe
4 234567 pres mike jones
5 234567 dir suzy sayz
6 234567秒paul north
等...
我需要1张与此类似的表...
ID corpname公司地址pres dir sec
1个小部件123456 1122第3个j.baker j.blow j.doe
2 acme 234564 123 4th m.jones s.sayz p.north
等...
我尝试过不同的关系,改变PK',un离子查询,附加查询等...我想出的是每个公司的一名官员...
任何帮助都表示赞赏。
Clint
Thanks to all in advance...
I have two tables...
corporations...
ID corpname corpnumber address
1 widgets 123456 1122 3rd
2 acme 234567 123 4th st
3 engineers 345678 987 wall st
etc...
officers...
ID corpnumber type fname lname
1 123456 pres john baker
2 123456 dir joe blow
3 123456 sec jane doe
4 234567 pres mike jones
5 234567 dir suzy sayz
6 234567 sec paul north
etc...
I need 1 table similar to this...
ID corpname corpnumber address pres dir sec
1 widgets 123456 1122 3rd j.baker j.blow j.doe
2 acme 234564 123 4th m.jones s.sayz p.north
etc...
I''ve tried different relationships, changing PK''s, union query, append query, etc... All I come up with is one officer per corporation...
Any help is appreciated.
Clint
推荐答案
尝试创建一个包含两个表的查询,并使用[Corporations]中的LEFT JOIN到Corporations.CorpNumber = Officers.CorpNumber上的[官员]。
你不需要一个新的表格,因为查询将完成你应该考虑的所有数据。相信我。一张新桌子是一个非常糟糕的主意(或者不相信我并要求推理 - 我很高兴。)
Try creating a query with both tables included and using a LEFT JOIN from [Corporations] to [Officers] on Corporations.CorpNumber = Officers.CorpNumber.
You don''t need a new table for this as the query will do all you should be thinking about with this data. Trust me on this. A new table would be a thoroughly bad idea (Or don''t trust me and ask for reasoning - I''m happy either way).
NeoPa
还是没什么......任何想法我的PK应该是什么?我应该有多个吗?
NeoPa
Still nothin... Any Idea what my PK''s should be? Should I have multiple?
你需要一个交叉表查询来获得你正在寻找的格式的结果。
You''re going to need a crosstab query to get the result in the format you''re looking for.
这篇关于Access 2007 ...合并两个表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!