表2的返回值 [英] returning value from table 2
问题描述
我有2个表,我想从表2中检索与查询1中的信息中的数据匹配的数据.
查询1:
月
原始状态
目标状态
包裹总数
表2
原始状态
目的地位置
区域
我希望查询返回表一中的所有信息,并使用该信息返回该信息匹配的区域.我尝试只是将其分组,查找,加入.我确定我会做错所有事情.我一直在教自己访问权限,但要全神贯注于如何执行此操作.显然我是游戏的新手.
任何人都可以帮助.!!!
I have 2 tables and i want to retrieve the data from table 2 that matches the data from the information in query 1.
query 1:
month
origin state
destination state
total amount of packages
table 2
origin state
destination stae
zone
I want the query to return all of the information from table one and with that information return the zone that that information matches. I tried just grouping it, dlookups, joins. Im sure I am going about it all wrong. I''ve been teaching myself access as I go but keeping racking my brains on how to do this. Apparently I brand new to the game.
anyone please help.!!!
推荐答案
您将需要类似这样的sql,但是请替换表和列中的专有名称.
You will need sql something like this, but replace the proper names from your tables and columns.
SELECT table1.month,
table1.origin_state,
table1.destination_state,
table1.total_packages,
table2.zone
FROM table1
INNER JOIN table2
ON table2.origin_state = table1.origin_state
AND table2.destination_state = table1.destination_state
这篇关于表2的返回值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!