473,411 Members | 1,949 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,411 software developers and data experts.

which join?

Hello,
I have a scenario where I have unique identifiers in about 25 tables,
each table has varying fields - eg.

Table #1 Table #2 Table #3 Table #4
--------- -------- -------- --------
sample_no sample_no sample_no sample_no
coords test1 test2 test3
desc desc desc notes
absorb diff

The 25 tables correspond to different chemical tests that are run on
each sample. Each test has its own "fields", and hence its own table.

Now, I want to query the tables where the sample number is 31601 and
let's say that sample_no exists in all but table #3. So essentially, I
wish to query every table and extract everything from those table(s)
which have data on sample_no 31601. It turns out that when I query
using a straight select statement, it returns nothing if one of the
tables doesn't have that sample_no(31601). If I remove the table which
is does not have sample_no = 31601, it works just fine. I have
surmised this is due to the type of JOIN that MS-Access uses in its
query builder.

Not sure where to go from here...
Is there any way can I get around this?
Thanks in advance!
jkm
Nov 13 '05 #1
1 1427
Hi Justin

The best structure might be to use one Test table that contains the basic
fields such as:
TestID AutoNumber
TestDate Date/Time
LabID Foreign key indicating which lab (or staff) did the test
and so on. Any field that is common to most tests could go into this table.

If a test has fields that are unique to it, such as a series of steps or a
series of results, it may be possible to use a TestDetail table, and create
one record for each step/result. In this case you end up with a very simple
and easy to query pair of tables.

If that is not practical, you may need several related tables as you
currently have, but each one will have the TestID as a foreign key. Or
perhaps your "sample_no" is actually a foreign key like that? If so, then
you need to use an outer join from the main Test/Sample table to each of the
other tables. In query design view, double-click the line joining the Test
table to your Table2. Access offers 3 choices. Choose the one that says,
"All records from Test table, and ...".

It is fairly easy to end up with "ambiguous outer join" problems. But if you
end up with the arrowheads all pointing away from the Test table, it should
work.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Justin" <jm***@bud.ca> wrote in message
news:34**************************@posting.google.c om...


I have a scenario where I have unique identifiers in about 25 tables,
each table has varying fields - eg.

Table #1 Table #2 Table #3 Table #4
--------- -------- -------- --------
sample_no sample_no sample_no sample_no
coords test1 test2 test3
desc desc desc notes
absorb diff

The 25 tables correspond to different chemical tests that are run on
each sample. Each test has its own "fields", and hence its own table.

Now, I want to query the tables where the sample number is 31601 and
let's say that sample_no exists in all but table #3. So essentially, I
wish to query every table and extract everything from those table(s)
which have data on sample_no 31601. It turns out that when I query
using a straight select statement, it returns nothing if one of the
tables doesn't have that sample_no(31601). If I remove the table which
is does not have sample_no = 31601, it works just fine. I have
surmised this is due to the type of JOIN that MS-Access uses in its
query builder.

Not sure where to go from here...
Is there any way can I get around this?
Thanks in advance!
jkm

Nov 13 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Alan Mailer | last post by:
Imagine I had a table called MyTable with the following values: Field1 Field2 ____ _____ A X AA R B X BB T Now, say I want to return only rows which match *BOTH* of the
3
by: Edward | last post by:
ASP.NET / VB.NET SQL Server 7.0 Our client has insisted that we change our established practice of building SQL in-line and move it all to SPROCs. Not a problem for 80% of the app. However,...
8
by: Matt | last post by:
Hello I have to tables ar and arb, ar holds articles and a swedish description, arb holds descriptions in other languages. I want to retreive all articles that match a criteria from ar and...
14
by: Bob | last post by:
I have a function that takes in a list of IDs (hundreds) as input parameter and needs to pass the data to another step as a comma delimited string. The source can easily create this list of IDs in...
16
by: John Salerno | last post by:
My initial feeling is that concatenation might take longer than substitution, but that it is also easier to read: def p(self, paragraph): self.source += '<p>' + paragraph + '</p>\n\n' vs. ...
0
by: alex | last post by:
Hi Friends, Let me start by apologising for the unsolicited mail. I have been extremely happy with the knowledge provided by this group and would like to pay back in a small way. ...
2
theGeek
by: theGeek | last post by:
I always wonder which one of join or subquery should I be using to solve a particuar problem so that I get the correct result set in minimum time. It usually happens that I can write a query quickly...
6
by: Kelii | last post by:
Hello, So I have a form which shows all items available for sale, when it was last sold, where it was last sold, and whether it is active or inactive. I would like to be able to edit the...
4
by: SjaakBanaan | last post by:
Hey all, I have a question that ought to be simple but has given me headaches for a while. I have a table with contact email addresses, say. T ID ContID Priority Emailaddress...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.