Un-expected Query results (1 Viewer)

got_access:]

Registered User.
Local time
Today, 01:00
Joined
Jun 15, 2018
Messages
83
Hi All
I have these three ultra simple tables.


When I add Table_A to the query editor with this query
SELECT TABLE_A.[TABLE_A DATA VALUE] FROM TABLE_A;
It returns 6 records - which I would expect.

However, when I add TABLE_B into the editor
SELECT TABLE_A.[TABLE_A DATA VALUE] FROM TABLE_A, TABLE_B;
It returns 18 records

And when I then add TABLE_C into the editor
SELECT TABLE_A.[TABLE_A DATA VALUE] FROM TABLE_A, TABLE_B, TABLE_C;
It returns 108 records.
I know its adding all of the rows from the other tables - but since I didn't add those rows within the SQL query itself - I 'm surprised it added them in the results.

This must be an inherent characteristic of the Access query editor?
This makes me think there is some kind of join going on - by default - is there?
 

Attachments

  • TableABC.PNG
    TableABC.PNG
    15.9 KB · Views: 133

pbaldy

Wino Moderator
Staff member
Local time
Today, 01:00
Joined
Aug 30, 2003
Messages
36,132
It's because there's no join. With no join you get a Cartesian product. What are you expecting, and is there a relationship between the tables?
 

theDBguy

I’m here to help
Staff member
Local time
Today, 01:00
Joined
Oct 29, 2018
Messages
21,531
Hi. Take a look at this article to explain what you're seeing.
 

got_access:]

Registered User.
Local time
Today, 01:00
Joined
Jun 15, 2018
Messages
83
Awesome!
Thank you - it made for a cross join by default - or Cartesian Product.

Thanks!
Funny - I've been using Access consistently for about a year now and I'm just getting around to noticing that!:confused:
 

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Today, 03:00
Joined
Feb 28, 2001
Messages
27,313
Access is good at hand-holding, but sometimes you run into this little hold-over from set theory that rears its ugly head.
 

Users who are viewing this thread

Top Bottom