Need help with joins and queries

jdcollins88

New Member
Joined
Jan 28, 2013
Messages
5
Hello, I am very new to access and am having trouble getting started. I have acquired an already constructed access database and am trying to pull out data in a specific format so I can run some stats. I have multiple tables, two of which contain the information I am after. One of the tables contain the capture information including which net the animal was captured in, which site, date etc. Another table contains the information on said net for that site. For example

Table 1.
[TABLE="width: 500"]
<tbody>[TR]
[TD]Species[/TD]
[TD]Date[/TD]
[TD]Site[/TD]
[TD]Net[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]MYLU[/TD]
[TD]8/14/2010[/TD]
[TD]FR143[/TD]
[TD]A[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]MYSE[/TD]
[TD]8/16/2011[/TD]
[TD]FR143[/TD]
[TD]A[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]MYSO[/TD]
[TD]8/16/2011[/TD]
[TD]FR142[/TD]
[TD]A[/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]

Table 2.
[TABLE="width: 500"]
<tbody>[TR]
[TD]Site[/TD]
[TD]Date[/TD]
[TD]Net A Height[/TD]
[TD]Net B Height[/TD]
[/TR]
[TR]
[TD]FR143[/TD]
[TD]8/14/2010[/TD]
[TD]2.6[/TD]
[TD]3.5[/TD]
[/TR]
[TR]
[TD]FR143[/TD]
[TD]8/16/2010[/TD]
[TD]5.2[/TD]
[TD]2.6[/TD]
[/TR]
</tbody>[/TABLE]

Currently only site name is joined between the tables, I believe I should join date as well, but am a little confused as how to join the net to net height, instead of trying to explain here is my desired outcome.

[TABLE="width: 500"]
<tbody>[TR]
[TD]Site[/TD]
[TD]Date[/TD]
[TD]Net[/TD]
[TD]Height of net [/TD]
[TD]Number captured[/TD]
[/TR]
[TR]
[TD]FR143[/TD]
[TD]8/14/2010[/TD]
[TD]A[/TD]
[TD]2.6 [/TD]
[TD]1[/TD]
[/TR]
[TR]
[TD]FR143[/TD]
[TD]8/16/2011[/TD]
[TD]A[/TD]
[TD]5.2[/TD]
[TD]2[/TD]
[/TR]
</tbody>[/TABLE]

I've tried multiple ways of querying without any luck so here I am.
If further clarification is needed I will be more than happy to provide it

Thanks for the help
Jason
 
Last edited:

Excel Facts

Back into an answer in Excel
Use Data, What-If Analysis, Goal Seek to find the correct input cell value to reach a desired result
Here is a SQL statement to capture the data you are showing.
Code:
SELECT Table1.Site, Table1.Date1, Table1.Net, Table2.NetAHeight
FROM Table1 INNER JOIN Table2 ON (Table1.Date1 = Table2.Date1) AND (Table1.Site = Table2.Site);

Note I changed the Date Field to Date1 as Date is a reserved name in Access and may cause issues in the future.
 
Upvote 0

Forum statistics

Threads
1,223,250
Messages
6,171,036
Members
452,374
Latest member
keccles

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top