473,397 Members | 2,028 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,397 software developers and data experts.

Editing disabled by alternative to INNER JOIN

Hi,

Solved a little mystery yesterday when I built a form that combined 2
tables with a 1:M relationship and relational integrity. All the
correct data was visible on the form but, if I tried to edit any of
the fields, the PC bleeped.

Seems it was due to the query the form was based on. Again, editing
any of the fields of the query caused the PC to bleep.

The problem lay in the SQL behind the query. I'm more comfortable with
SQL than the graphical Design View (in fact I teach classes in SQL).
If you let Access build a query, it will give you:

SELECT * FROM teachers INNER JOIN subjects ON
teachers.name=subjects.taught_by;

but I had typed in the equivalent

SELECT * FROM teachers, subjects WHERE
teachers.name=subjects.taught_by;

The query results are identical, but Access is no longer willing to
write back the edits to the right tables. I guess the INNER JOIN
construction makes possible some safety checking.

I've learned a lesson and perhaps posting this message might help
someone else one day.

Bye for now,

Chris

Aug 3 '07 #1
14 2469
Hi, Chris.
SELECT * FROM teachers INNER JOIN subjects ON
teachers.name=subjects.taught_by;

but I had typed in the equivalent

SELECT * FROM teachers, subjects WHERE
teachers.name=subjects.taught_by;
These two queries are _not_ equivalent in Jet (Access). The second query
uses a Cartesian Join, instead of an ANSI join. A Cartesian Join matches
every row in one table to every row in the other table (even when there is
no logical correlation). A query that uses a Cartesian Join is not
updateable, that's why you hear the beeps. The fact that you placed a WHERE
clause narrowed the results so that the results of the two queries look
identical. However, if you remove the WHERE clause in both queries and then
compare the results, you'll see two very different result sets. Only the
WHERE clause hides the effects of the Cartesian Join (except for the slower
speed when running the query).
I guess the INNER JOIN
construction makes possible some safety checking.
The INNER JOIN allows updateable recordsets, and is much more efficient in
Jet queries. It's easy to run out of resources when using a Cartesian Join
with larger data sets. They take a longer time for Jet to run than when
using an INNER JOIN, too.

HTH.
Gunny

See http://www.QBuilt.com for all your database needs.
See http://www.Access.QBuilt.com for Microsoft Access tips and tutorials.
Blogs: www.DataDevilDog.BlogSpot.com, www.DatabaseTips.BlogSpot.com
http://www.Access.QBuilt.com/html/ex...ributors2.html for contact
info.
Aug 4 '07 #2
"'69 Camaro" <Fo**************************@Spameater.orgZERO_SP AM>
wrote in news:jFXsi.228$V53.2@trnddc08:
Hi, Chris.
>SELECT * FROM teachers INNER JOIN subjects ON
teachers.name=subjects.taught_by;

but I had typed in the equivalent

SELECT * FROM teachers, subjects WHERE
teachers.name=subjects.taught_by;

These two queries are _not_ equivalent in Jet (Access). The
second query uses a Cartesian Join, instead of an ANSI join.
You you checked SHOWPLAN on this? I have, and it shows that a JOIN
statement converted to a WHERE clauses is optimized exactly the
same. In this case, the WHERE clause and JOIN is identical, so it
would be treated exactly the same by Jet.
A Cartesian Join matches
every row in one table to every row in the other table (even when
there is no logical correlation).
There will be no Cartesian join in either case, unless there's no
index on the fields in the JOIN/WHERE statement.
A query that uses a Cartesian Join is not
updateable, that's why you hear the beeps. The fact that you
placed a WHERE clause narrowed the results so that the results of
the two queries look identical. However, if you remove the WHERE
clause in both queries and then compare the results, you'll see
two very different result sets. Only the WHERE clause hides the
effects of the Cartesian Join (except for the slower speed when
running the query).
I don't know about editability, but Jet optimizes the two queries
exactly the same way.

--
David W. Fenton http://www.dfenton.com/
usenet at dfenton dot com http://www.dfenton.com/DFA/
Aug 4 '07 #3
On Sat, 04 Aug 2007 09:28:47 GMT, "'69 Camaro"
<Fo**************************@Spameater.orgZERO_SP AMwrote:
>Hi, Chris.
>SELECT * FROM teachers INNER JOIN subjects ON
teachers.name=subjects.taught_by;

but I had typed in the equivalent

SELECT * FROM teachers, subjects WHERE
teachers.name=subjects.taught_by;

These two queries are _not_ equivalent in Jet (Access). The second query
uses a Cartesian Join, instead of an ANSI join. A Cartesian Join matches
every row in one table to every row in the other table (even when there is
no logical correlation). A query that uses a Cartesian Join is not
updateable, that's why you hear the beeps. The fact that you placed a WHERE
clause narrowed the results so that the results of the two queries look
identical. However, if you remove the WHERE clause in both queries and then
compare the results, you'll see two very different result sets. Only the
WHERE clause hides the effects of the Cartesian Join (except for the slower
speed when running the query).
>I guess the INNER JOIN
construction makes possible some safety checking.

The INNER JOIN allows updateable recordsets, and is much more efficient in
Jet queries. It's easy to run out of resources when using a Cartesian Join
with larger data sets. They take a longer time for Jet to run than when
using an INNER JOIN, too.

HTH.
Gunny

See http://www.QBuilt.com for all your database needs.
See http://www.Access.QBuilt.com for Microsoft Access tips and tutorials.
Blogs: www.DataDevilDog.BlogSpot.com, www.DatabaseTips.BlogSpot.com
http://www.Access.QBuilt.com/html/ex...ributors2.html for contact
info.
I don't believe that this particular example is a "Cartesian Join".
Both forms of the query create a valid ANSI join and are valid ANSI
syntax. The first example uses the newer SQL/92 syntax, the second
uses the older SQL/88 syntax.
Aug 4 '07 #4
Bob Quintal <rq******@sPAmpatico.cawrote in
news:Xn**********************@66.150.105.47:
The where clause approach is still the only one supported by
some major databases, and the Access query builder does not
allow a join on a.field < b.field.
Sure it does. You just have to edit it in SQL view and then not try
to view it with the query designer.

There are also cases in Access where you can't use a join where a
WHERE clause will work. I have to do this frequently with "joins" on
GUID fields in the Jet replication tables. In that case,
updatability is moot, as the tables are not themselves updatable.

--
David W. Fenton http://www.dfenton.com/
usenet at dfenton dot com http://www.dfenton.com/DFA/
Aug 6 '07 #5
"David W. Fenton" <XX*******@dfenton.com.invalidwrote in
news:Xn**********************************@127.0.0. 1:
Bob Quintal <rq******@sPAmpatico.cawrote in
news:Xn**********************@66.150.105.47:
>The where clause approach is still the only one supported by
some major databases, and the Access query builder does not
allow a join on a.field < b.field.

Sure it does. You just have to edit it in SQL view and then
not try to view it with the query designer.
Try not to view it.... how can one open a query directly to SQL
mode, instead of design view?
>
There are also cases in Access where you can't use a join
where a WHERE clause will work. I have to do this frequently
with "joins" on GUID fields in the Jet replication tables. In
that case, updatability is moot, as the tables are not
themselves updatable.


--
Bob Quintal

PA is y I've altered my email address.

--
Posted via a free Usenet account from http://www.teranews.com

Aug 6 '07 #6
On 06 Aug 2007 00:17:30 GMT, Bob Quintal <rq******@sPAmpatico.cawrote:
>Try not to view it.... how can one open a query directly to SQL
mode, instead of design view?
If you save the query while in SQL view the query will open at the SQL view when
design is selected from the database window, not the "standard" design view.
Wayne Gillespie
Gosford NSW Australia
Aug 6 '07 #7
Wayne Gillespie <be*****@NOhotmailSPAM.com.auwrote in
news:ah********************************@4ax.com:
On 06 Aug 2007 00:17:30 GMT, Bob Quintal
<rq******@sPAmpatico.cawrote:
>>Try not to view it.... how can one open a query directly to
SQL mode, instead of design view?

If you save the query while in SQL view the query will open at
the SQL view when design is selected from the database window,
not the "standard" design view.
Wayne Gillespie
Gosford NSW Australia
I wish it would...
--
Bob Quintal

PA is y I've altered my email address.

--
Posted via a free Usenet account from http://www.teranews.com

Aug 6 '07 #8

"Bob Quintal" <rq******@sPAmpatico.caschreef in bericht news:Xn**********************@66.150.105.47...
Wayne Gillespie <be*****@NOhotmailSPAM.com.auwrote in
news:ah********************************@4ax.com:
>On 06 Aug 2007 00:17:30 GMT, Bob Quintal
<rq******@sPAmpatico.cawrote:
>>>Try not to view it.... how can one open a query directly to
SQL mode, instead of design view?

If you save the query while in SQL view the query will open at
the SQL view when design is selected from the database window,
not the "standard" design view.
Wayne Gillespie
Gosford NSW Australia
I wish it would...
It does. I guess you are forgetting to save explicitly

Arno R
Aug 6 '07 #9
Bob Quintal <rq******@sPAmpatico.cawrote in
news:Xn**********************@66.150.105.47:
"David W. Fenton" <XX*******@dfenton.com.invalidwrote in
news:Xn**********************************@127.0.0. 1:
>Bob Quintal <rq******@sPAmpatico.cawrote in
news:Xn**********************@66.150.105.47:
>>The where clause approach is still the only one supported by
some major databases, and the Access query builder does not
allow a join on a.field < b.field.

Sure it does. You just have to edit it in SQL view and then
not try to view it with the query designer.

Try not to view it.... how can one open a query directly to SQL
mode, instead of design view?
The query designer saves the view. If you save it in SQL view, it
will open next in SQL view. In the case of a non-equi-join, the
query designer will never let you switch to design view (just as
with UNION queries).

--
David W. Fenton http://www.dfenton.com/
usenet at dfenton dot com http://www.dfenton.com/DFA/
Aug 6 '07 #10
Bob Quintal <rq******@sPAmpatico.cawrote in
news:Xn**********************@66.150.105.47:
Wayne Gillespie <be*****@NOhotmailSPAM.com.auwrote in
news:ah********************************@4ax.com:
>On 06 Aug 2007 00:17:30 GMT, Bob Quintal
<rq******@sPAmpatico.cawrote:
>>>Try not to view it.... how can one open a query directly to
SQL mode, instead of design view?

If you save the query while in SQL view the query will open at
the SQL view when design is selected from the database window,
not the "standard" design view.

I wish it would...
Are you saying that your version of Access does not do that?

Or that you can't do it with other kinds of queries?

I have some normal queries that work fine in design view that have
been saved in SQL view and that open in SQL view the next time I
design them. But I've never tested it systematically to see if I can
force the query to always open in SQL view.

Is that what you mean?

--
David W. Fenton http://www.dfenton.com/
usenet at dfenton dot com http://www.dfenton.com/DFA/
Aug 6 '07 #11
"David W. Fenton" <XX*******@dfenton.com.invalidwrote in
news:Xn**********************************@127.0.0. 1:
Bob Quintal <rq******@sPAmpatico.cawrote in
news:Xn**********************@66.150.105.47:
>"David W. Fenton" <XX*******@dfenton.com.invalidwrote in
news:Xn**********************************@127.0.0 .1:
>>Bob Quintal <rq******@sPAmpatico.cawrote in
news:Xn**********************@66.150.105.47:

The where clause approach is still the only one supported
by
>>>some major databases, and the Access query builder does not
allow a join on a.field < b.field.

Sure it does. You just have to edit it in SQL view and then
not try to view it with the query designer.

Try not to view it.... how can one open a query directly to
SQL
>mode, instead of design view?

The query designer saves the view. If you save it in SQL view,
it
will open next in SQL view. In the case of a non-equi-join,
the
query designer will never let you switch to design view (just
as
with UNION queries).
I will assume that this behaviour is a change since Access 97,
because that version trashes the SQL if I try to open a query
saved in SQL mode, it opens in design mode, with a non-equi-join
SQL statement.

But it's good to know. Thanks for the info.

--
Bob Quintal

PA is y I've altered my email address.

--
Posted via a free Usenet account from http://www.teranews.com

Aug 7 '07 #12
Bob Quintal wrote:
I will assume that this behaviour is a change since Access 97,
because that version trashes the SQL if I try to open a query
saved in SQL mode, it opens in design mode, with a non-equi-join
SQL statement.

But it's good to know. Thanks for the info.
Hmm, I exclusively design in A97 and when I open a query with a non-equi-join in
design view I get a message that the join cannot be represented in the query
design window and then after acknowledging that message I get SQL view. I have
never experienced the query getting "trashed".

--
Rick Brandt, Microsoft Access MVP
Email (as appropriate) to...
RBrandt at Hunter dot com
Aug 7 '07 #13
Bob Quintal <rq******@sPAmpatico.cawrote in
news:Xn**********************@66.150.105.47:
"David W. Fenton" <XX*******@dfenton.com.invalidwrote in
news:Xn**********************************@127.0.0. 1:
>Bob Quintal <rq******@sPAmpatico.cawrote in
news:Xn**********************@66.150.105.47:
>>"David W. Fenton" <XX*******@dfenton.com.invalidwrote in
news:Xn**********************************@127.0. 0.1:

Bob Quintal <rq******@sPAmpatico.cawrote in
news:Xn**********************@66.150.105.47:

The where clause approach is still the only one supported
by
>>>>some major databases, and the Access query builder does not
allow a join on a.field < b.field.

Sure it does. You just have to edit it in SQL view and then
not try to view it with the query designer.

Try not to view it.... how can one open a query directly to
SQL
>>mode, instead of design view?

The query designer saves the view. If you save it in SQL view,
it
>will open next in SQL view. In the case of a non-equi-join,
the
>query designer will never let you switch to design view (just
as
>with UNION queries).
I will assume that this behaviour is a change since Access 97,
because that version trashes the SQL if I try to open a query
saved in SQL mode, it opens in design mode, with a non-equi-join
SQL statement.
Hmm. I did my testing in A97 first, and it worked exactly as I
describd it.
But it's good to know. Thanks for the info.
Most of my work is A97, and I do this kind of thing all the time and
have very seldom "trashed" my SQL (though it has happened, yes).

--
David W. Fenton http://www.dfenton.com/
usenet at dfenton dot com http://www.dfenton.com/DFA/
Aug 7 '07 #14
Arch <se*****@spam.netwrote in
news:ah********************************@4ax.com:
I made no suggestion that the two statements would be treated
identically by Jet.
But the *are* optimized the same by Jet, as you can find out by
turning on SHOWPLAN.

--
David W. Fenton http://www.dfenton.com/
usenet at dfenton dot com http://www.dfenton.com/DFA/
Aug 7 '07 #15

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

Similar topics

3
by: Ike | last post by:
Oh I have a nasty query which runs incredibly slowly. I am running MySQL 4.0.20-standard. Thus, in trying to expedite the query, I am trying to set indexes in my tables. My query requires four...
3
by: Prem | last post by:
Hi, I am having many problems with inner join. my first problem is : 1) I want to know the precedance while evaluating query with multiple joins. eg. select Employees.FirstName,...
4
by: Nathan | last post by:
I have an application that uses an Access database to gather information on students' test scores. In the database there are three tables which are joined by one- to-many relationships: ...
4
by: Marcos Beccar Varela | GamaCom Argentina | last post by:
Hello Everyone. I need to use a gridview, that when I use the Update command one of the colums, instead of showing a textbox where the user can write, I need a combobox (listobx), where there are...
6
by: dmonroe | last post by:
hi group -- Im having a nested inner join problem with an Access SQl statement/Query design. Im running the query from ASP and not usng the access interface at all. Here's the tables: ...
52
by: MP | last post by:
Hi trying to begin to learn database using vb6, ado/adox, mdb format, sql (not using access...just mdb format via ado) i need to group the values of multiple fields - get their possible...
12
by: Chamnap | last post by:
Hello, everyone I have one question about the standard join and inner join, which one is faster and more reliable? Can you recommend me to use? Please, explain me... Thanks Chamnap
1
by: teneesh | last post by:
Here I have a code for a view that has been created by a developer on my team. I am trying to use the very same code to create a view for a different formid/quesid. But I cannot figure out how this...
2
by: MATTXtwo | last post by:
I have this store procedure to select data from table with join like this...SELECT tblPeribadi.Personel_No, tblPeribadi.Nama,tblCompany.Keterangan as Company_Code, tblPeribadi.Jawatan,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.