473,396 Members | 1,998 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,396 software developers and data experts.

help with converting query to use inner joins

the following query works fine:

select link.idx, link.x_table, link.x_id_a, link.x_id_z, a.strandid,
b.strandid
from link_detail, link, strand A, strand B
where link_detail.x_table = 'enclosure' and link_detail.x_id = 3 and
link.idx = link_detail.linkidx
and A.strandid = link.x_id_a and B.strandid = link.x_id_z

would someone please convert this to a more efficient query using inner
joins please.

thanks.

Apr 7 '06 #1
2 1601

select t1.idx, t1.x_table, t1.x_id, t1.x_id_z, a.strandID, b.strandID
From (link_detail t1 join strandA a on t1.idx = a.strandID) join strandB
b On t1.idx = b.strandID

Rich

*** Sent via Developersdex http://www.developersdex.com ***
Apr 7 '06 #2
gk********@gmail.com wrote:
the following query works fine:

select link.idx, link.x_table, link.x_id_a, link.x_id_z, a.strandid,
b.strandid
from link_detail, link, strand A, strand B
where link_detail.x_table = 'enclosure' and link_detail.x_id = 3 and
link.idx = link_detail.linkidx
and A.strandid = link.x_id_a and B.strandid = link.x_id_z

would someone please convert this to a more efficient query using inner
joins please.

I think this is the equivalent query using joins:

SELECT link.idx, link.x_table, link.x_id_a, link.x_id_z,
A.strandid, B.strandid
FROM ((link_detail
INNER JOIN link
ON link.idx = link_detail.linkidx)
INNER JOIN strand A
ON A.strandid = link.x_id_a)
INNER JOIN strand B
ON B.strandid = link.x_id_z
WHERE link_detail.x_table = 'enclosure'
AND link_detail.x_id = 3

I doubt that it will be much faster though. I'm not sure
but Access may actually translate the JOINs to the form you
had before. Either way the key to making these queries run
faster is to index the linking and criteria fields.

--
Marsh
MVP [MS Access]
Apr 7 '06 #3

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

Similar topics

13
by: aaron | last post by:
I have a question about (i think) joining. If I have a table in a database that has this info: key - name - favorite 1 - john - 2 2 - judy - 3 3 - joe - 1 the favorite icecream...
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,...
2
by: Sonal Jain | last post by:
i have a query which goes like this:- select a.col1,b.col2,c.col2 from tab1 a,tab2 b,tab3 c where a.col1 *= b.col1 and a.col2 *= c.col2 and b.col3 = c.col3 how do I write this query in SQL...
5
by: Terry Bell | last post by:
I'm upsizing an Access database. Got the data converted, working on the front end, converting queries to views, but having trouble converting queries that use logical expressions like the...
5
by: Ciar?n | last post by:
I have about 7 tables I need to join, but am having a lot of difficulty with the joins, that I need some help on. I'll provide the details of four tables to illustrate the scenario. I have one...
8
by: Andrew McNab | last post by:
Hi folks, I have a problem with an MS Access SQL query which is being used in an Access Report, and am wondering if anyone can help. Basically, my query (shown below) gets some records from a...
5
by: khan | last post by:
i have 2 queries totaldues and totalPayments totaldues has 2 fileds(custID (Group By) amountDue(sum of all invoices dues) and totalPayments consist of CustID(Group By) and Amount_Paid(sum of all...
4
by: Pasquale | last post by:
Is the problem with the query below in the SELECT?? Should I be using PHP to do some of things I am trying to get the SELECT to do? What is happening is it opens 3 or 4 of the same query/process...
1
by: rando1000 | last post by:
I've got a query from SQL Server that I'm trying to carry over to Access. The Query uses 3 tables with two INNER JOINS, and each of the INNER JOINS has two operators, roughly like this: Select...
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
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
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.