Jumat, 19 Februari 2016

Re: [MS_AccessPros] Join me in a discussion of .... joins



I don't understand your second scenario.  It would be clearer if you coded the FROM clause that you're using.

Note that if tables 2, 3, and 4 are all related to table 1 1-to-many, then a query including all four tables will not be updatable because you will be creating the Cartesian Product of all rows in 2, 3, and 4 that are related to 1.

John Viescas, Author
Microsoft Access 2010 Inside Out
Microsoft Access 2007 Inside Out
Microsoft Access 2003 Inside Out
Building Microsoft Access Applications 
SQL Queries for Mere Mortals 
(Paris, France)

On Feb 19, 2016, at 1:38 PM, 'Glenn Lloyd' argeedblu@gmail.com [MS_Access_Professionals] <MS_Access_Professionals@yahoogroups.com> wrote:

Bad pun most definitely intentional and offered without apology.
I would like to expand my knowledge of joins especially in the following scenario.
Table1 is the primary table and has say, 100 records.
Tables2, 3, and 4 are relate subsidiary tables with foreign keys related to Table1's primary key. Table 2 has 30 related records, Table3 has 10 and Table4 has 35.
As I see it, there are two different ways of setting up the joins with a number of variations that I won't introduce here.
Scenario 1:
Table1 - Left - Table2 – Left - Table3 – Left – Table4
Scenario 2:
Table1 – Left – Table2
Table1 – Left - Table3
Table1 – Left - Table4
From what I have observed, queries using either of these scenarios yield the same 100 records with null records where none of them have a foreign key to one of Table1's records.
My question is whether there are any significant differences, or hidden pitfalls to either of these approaches and which yields the more efficient query.


Posted by: John Viescas <johnv@msn.com>
Reply via web post Reply to sender Reply to group Start a New Topic Messages in this topic (2)



Tidak ada komentar:

Posting Komentar